# reloadly/reloadly-sdk-java architecture

> Architecture diagram of the GitHub repository reloadly/reloadly-sdk-java, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/reloadly/reloadly-sdk-java
- Repository: https://github.com/reloadly/reloadly-sdk-java

## Overview

##### Main Components

a. Core Module Components:
- Authentication Service
- Airtime Service
- Giftcard Service
- Core Infrastructure Layer

b. External Components:
- Reloadly API Services
- Client Applications

##### Architectural Layers

**┌─────────────────────────────────────────────────────────────┐**
- Client Applications                       │
- ┬─────────────────────────────────┘

**┌───────────────────────────▼─────────────────────────────────┐**
- Reloadly Java SDK                        │
- ┌─────────────┐    ┌──────────────┐    ┌──────────────┐   │
- Airtime    │    │  Giftcard    │    │Authentication│   │
- Module    │    │   Module     │    │    Module    │   │
- ┬──────┘    └──────┬───────┘    └──────┬──────┘   │

- ┌──────▼───────────────────▼────────────────────▼──────┐  │
- Core Module                        │  │
- ┌─────────────┐  ┌────────────┐  ┌──────────────┐   │  │
- HTTP      │  │  Service   │  │ Exception    │   │  │
- Client    │  │   API      │  │ Handling    │   │  │
- ┘  └────────────┘  └──────────────┘   │  │
- ┬───────────────────────────┘  │
- ┼───────────────────────────────┘

**┌───────────────────────────────▼───────────────────────────────┐**
- Reloadly API Services                      │
- ┘

##### Component Details

For each SDK Module:
**┌─────────────────────────────────────┐**
- Module (e.g., Airtime)    │

- ┌─────────────┐    ┌─────────────┐ │
- Operations  │    │    DTOs     │ │
- ┘    └─────────────┘ │
- ┌─────────────┐    ┌─────────────┐ │
- Client    │    │   Filters   │ │
- ┘    └─────────────┘ │
- ┘

##### Additional Elements

- Component types
- Version information
- Environment support (Sandbox/Production)

##### Interactions to Highlight
- Authentication flow
- API request/response cycle
- Error handling paths
- Data transformation flow

##### Technical Details
**┌─────────────────────────────────────┐**
- Technical Specifications    │
- Java 1.8+                        │
- Maven/Gradle Support             │
- REST API Integration             │
- OAuth2 Authentication            │
- ┘

##### Client usage patterns

This system design will help developers understand:
- How the different modules interact
- The flow of data through the system
- Where to add new features
- How to troubleshoot issues
- Integration points for their applications

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph ClientApps["Client Applications"]
        CA[Client App]
    end

    subgraph SDK["Reloadly Java SDK"]
        subgraph Modules["SDK Modules"]
            subgraph Airtime["Airtime Module"]
                AC["AirtimeAPI"]:::client
                AO["Operations"]:::ops
                AD["DTOs"]:::dto
                AF["Filters"]:::filter
            end

            subgraph Giftcard["Giftcard Module"]
                GC["GiftcardAPI"]:::client
                GO["Operations"]:::ops
                GD["DTOs"]:::dto
                GF["Filters"]:::filter
            end

            subgraph Auth["Authentication Module"]
                AuthC["AuthenticationAPI"]:::client
                AuthO["OAuth2 Operations"]:::ops
            end
        end

        subgraph Core["Core Infrastructure"]
            HTTP["HTTP Client"]:::infra
            SA["Service API"]:::infra
            EH["Exception Handling"]:::infra
            BaseOps["Base Operations"]:::infra
            HttpOpt["HTTP Options"]:::infra
            URLs["Service URLs"]:::infra
        end
    end

    subgraph External["External Services"]
        RAS["Reloadly API Services"]
    end

    %% Connections
    CA --> AC & GC & AuthC
    AC & GC & AuthC --> Core
    Core --> RAS

    %% Internal Module Connections
    AC --> AO --> AD
    GC --> GO --> GD
    AuthC --> AuthO

    %% Core Infrastructure Connections
    HTTP --> SA
    SA --> EH
    BaseOps --> HttpOpt
    HttpOpt --> URLs

    %% Styling
    classDef client fill:#2196F3,stroke:#1565C0,color:white
    classDef ops fill:#4CAF50,stroke:#388E3C,color:white
    classDef dto fill:#FF9800,stroke:#F57C00,color:white
    classDef filter fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef infra fill:#607D8B,stroke:#455A64,color:white

    %% Click Events
    click AC "https://github.com/Reloadly/reloadly-sdk-java/blob/main/java-sdk-airtime/src/main/java/software/reloadly/sdk/airtime/client/AirtimeAPI.java"
    click AO "https://github.com/Reloadly/reloadly-sdk-java/tree/main/java-sdk-airtime/src/main/java/software/reloadly/sdk/airtime/operation/"
    click AD "https://github.com/Reloadly/reloadly-sdk-java/tree/main/java-sdk-airtime/src/main/java/software/reloadly/sdk/airtime/dto/"
    click GC "https://github.com/Reloadly/reloadly-sdk-java/blob/main/java-sdk-giftcard/src/main/java/software/reloadly/sdk/giftcard/client/GiftcardAPI.java"
    click GO "https://github.com/Reloadly/reloadly-sdk-java/tree/main/java-sdk-giftcard/src/main/java/software/reloadly/sdk/giftcard/operation/"
    click GD "https://github.com/Reloadly/reloadly-sdk-java/tree/main/java-sdk-giftcard/src/main/java/software/reloadly/sdk/giftcard/dto/"
    click AuthC "https://github.com/Reloadly/reloadly-sdk-java/blob/main/java-sdk-authentication/src/main/java/software/reloadly/sdk/authentication/client/AuthenticationAPI.java"
    click AuthO "https://github.com/Reloadly/reloadly-sdk-java/blob/main/java-sdk-authentication/src/main/java/software/reloadly/sdk/authentication/client/OAuth2ClientCredentialsOperation.java"
    click HTTP "https://github.com/Reloadly/reloadly-sdk-java/tree/main/java-sdk-core/src/main/java/software/reloadly/sdk/core/internal/net/"
    click SA "https://github.com/Reloadly/reloadly-sdk-java/blob/main/java-sdk-core/src/main/java/software/reloadly/sdk/core/internal/net/ServiceAPI.java"
    click EH "https://github.com/Reloadly/reloadly-sdk-java/tree/main/java-sdk-core/src/main/java/software/reloadly/sdk/core/exception/"
    click BaseOps "https://github.com/Reloadly/reloadly-sdk-java/blob/main/java-sdk-core/src/main/java/software/reloadly/sdk/core/internal/client/BaseOperation.java"
    click HttpOpt "https://github.com/Reloadly/reloadly-sdk-java/blob/main/java-sdk-core/src/main/java/software/reloadly/sdk/core/net/HttpOptions.java"
    click URLs "https://github.com/Reloadly/reloadly-sdk-java/blob/main/java-sdk-core/src/main/java/software/reloadly/sdk/core/constant/ServiceURLs.java"
```
