# 888leonidas888/googleapis architecture

> Architecture diagram of the GitHub repository 888leonidas888/googleapis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/888leonidas888/googleapis
- Repository: https://github.com/888leonidas888/googleapis

## Overview

##### Main Components
- VBA Client Application – This is the consumer (typically Excel or another Office product) that uses the DLL.
- GoogleApis DLL – The central library that exposes the functionality to VBA. Inside the DLL, break it down into:
– Drive Module: Contains subdirectories like Common, Component, Helper, and Interfaces. It encapsulates operations such as listing files, uploading/downloading files, creating folders, etc.
– Sheet Module: Similarly divided into Common, Component, Helper, and Interfaces. This module handles operations like creating spreadsheets, reading/writing data, and other sheets-related functions.
– OAuth Module: Implements the FlowOauth class (with its subdirectories and interfaces) that manages the OAuth 2.0 flow required for authentication.
- External Services – Represent Google’s endpoints:
– Google Drive API endpoint
– Google Sheets API endpoint
– OAuth 2.0 Authorization/Token endpoints

##### Relationships and Interactions
- The VBA Client calls the methods offered by the DLL (e.g., FlowOauth, GoogleDrive, and GoogleSheets classes).
- The OAuth Module communicates directly with Google’s OAuth endpoints to handle token retrieval and refreshing.
- The Drive and Sheets modules use the token (and API key) provided by the OAuth module to send REST API requests to Google Drive and Sheets endpoints.
- There is a configuration layer (credentials stored in JSON files) that the OAuth module reads to determine client credentials, API keys, and token storage location.

##### Architectural Patterns and Key Design Principles
- Modularity: The separation into “Drive”, “Sheet”, and “Oauth” modules with clearly defined interfaces allows for clean separation of concerns.
- Abstraction: Interfaces and helper classes abstract the complexity of making HTTP requests to external APIs.
- Layered Architecture: There is a client layer (VBA), an application/service layer (DLL with multiple components), and an external integration layer (Google APIs).
- Extensibility: The project structure (especially with interfaces for Drive and Sheets functionality) makes it easier to add or update supported API operations.

##### Relevant Technologies and Frameworks
- C# and .NET (for building the DLL)
- VBA for consuming the DLL (ensure correct COM registration and setup as per the Installer component)
- JSON for representing configuration and data payloads
- Google API endpoints for Drive and Sheets
- OAuth 2.0 protocol for managing authentication

##### Final Reminders for the Principal Software Engineer
- It’s best to visually separate the system into logical boundaries even if that means “over-separating” the various internal components; clarity is paramount.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["VBA Client Application"]:::client
    B["GoogleApis DLL"]:::dll
    subgraph "DLL Internal Modules"
        D["Drive Module"]:::dllModule
        E["Sheet Module"]:::dllModule
        F["OAuth Module"]:::dllModule
    end
    G(("Google Drive API")):::external
    H(("Google Sheets API")):::external
    I(("Google OAuth Endpoints")):::external
    J["JSON Credentials"]:::config
    K["Installer Component"]:::installer

    A -->|"calls"| B
    B --> D
    B --> E
    B --> F

    D -->|"calls"| G
    E -->|"calls"| H
    F -->|"authenticates"| I
    J -->|"providesConfig"| F
    K -->|"installsRegisters"| B

    click A "https://github.com/888leonidas888/googleapis/blob/master/Example/demo.bas"
    click D "https://github.com/888leonidas888/googleapis/tree/master/Drive/"
    click E "https://github.com/888leonidas888/googleapis/tree/master/Sheet/"
    click F "https://github.com/888leonidas888/googleapis/tree/master/Oauth/"
    click K "https://github.com/888leonidas888/googleapis/tree/master/Installer/GoogleApisForVBA"

    classDef client fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef dll fill:#A7D6D6,stroke:#000,stroke-width:2px;
    classDef dllModule fill:#BDD6EE,stroke:#000,stroke-width:1px;
    classDef external fill:#9fdf9f,stroke:#333,stroke-width:2px;
    classDef config fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef installer fill:#F66,stroke:#333,stroke-width:2px;
```
