# tihanajk/apireferencefinder architecture

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

- Interactive diagram: https://gitdiagram.com/tihanajk/apireferencefinder
- Repository: https://github.com/tihanajk/apireferencefinder

## Overview

##### Project type and purpose
- This is a single‐project XrmToolBox plugin (desktop‐based .NET tool) whose purpose is to scan Dynamics 365/Power Platform environments for API references in Power Automate flows and web resources.

##### File structure
- Top‐level files
- APIReferenceFinder.csproj, .sln, .nuspec – defines the plugin project, dependencies, packaging
- APIReferenceFinderPlugin.cs – implements the IPlugin interface/entry point
- APIReferenceFinderPluginControl.* – WinForms or WPF control for UI
- Settings.cs, app.config – plugin configuration
- MyToolDesign.excalidraw – draft of UI or flowchart
- No separate frontend/backend folders because it all lives in one .NET assembly loaded by XrmToolBox at runtime.

##### README
- Confirms it’s an XrmToolBox tool to find API calls in flows and web resources.

##### Main components
a. XrmToolBox Host
- Acts as a container that loads this plugin DLL via the XrmToolBox plugin SDK.
b. Plugin Assembly (APIReferenceFinder.dll)
- Entry point (IPlugin implementation in APIReferenceFinderPlugin.cs)
- UI layer (APIReferenceFinderPluginControl)
- Business/Scan logic (methods that query and parse flows and web resources)
- Configuration (Settings.cs, app.config)
c. Dataverse / Power Platform Environment
- The target organization where flows & web resources live
- Exposed via the Dataverse Web API / SDK assemblies (referenced in the .csproj)
d. External Services/APIs
- Power Automate Web API (to retrieve flow definitions)
- Dataverse Web API (to retrieve web resources)
e. Local Resources
- Any export files or logs you write to disk (if implemented)

##### Relationships & Data Flow
1. User launches XrmToolBox → selects APIReferenceFinder plugin in the list
2. XrmToolBox loads the plugin DLL → invokes Initialize() on APIReferenceFinderPlugin
3. PluginControl UI renders (buttons, grids, etc.)
4. User clicks “Scan” → UI calls business logic methods
5. Business logic uses the Dataverse connector from XrmToolBox SDK to authenticate & call
– Dataverse Web API → retrieve web resources
– Power Automate Web API → retrieve flow definitions
6. Plugin parses JSON/XML payloads → discovers API references
7. Plugin returns results to UI → displays in a grid or tree view
8. (Optional) Plugin writes export files or logs locally

##### Architectural patterns & design principles
- Plugin pattern: loaded by host via a well‐defined IPlugin interface
- Separation of Concerns:
- Plugin entry point vs. UI control vs. scanning logic vs. configuration
- Use of the XrmToolBox SDK as an abstraction over raw HTTP calls

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "APIReferenceFinder Architecture"
        Host["XrmToolBox Host"]:::host

        subgraph "APIReferenceFinder Plugin"
            Csproj["APIReferenceFinder.csproj"]:::plugin
            Sln["APIReferenceFinder.sln"]:::plugin
            Nuspec["APIReferenceFinder.nuspec"]:::plugin
            EntryPoint["Entry Point\n(APIReferenceFinderPlugin.cs)"]:::plugin
            UIControl["UI Control\n(APIReferenceFinderPluginControl.*)"]:::plugin
            BusinessLogic["Business Logic / Scanner"]:::plugin
            ConfigSettings["Settings.cs"]:::plugin
            AppConfig["app.config"]:::plugin
            ResourcesResx["Properties/Resources.resx"]:::plugin
            ResourcesDesigner["Properties/Resources.Designer.cs"]:::plugin
            AssemblyInfo["Properties/AssemblyInfo.cs"]:::plugin
            ImgButtons["img/buttons/"]:::plugin
            ImgLogo["img/logo/"]:::plugin
            Packages["packages.config"]:::plugin
            Readme["README.md"]:::doc
            Draft["MyToolDesign.excalidraw"]:::doc
        end

        Dataverse["Dataverse / Power Platform Env."]:::external
        PowerAutomate["Power Automate Web API"]:::external
        LocalIO["Local Export / Logs"]:::local

        Host -->|"Loads DLL,\ncalls Initialize()"| EntryPoint
        EntryPoint --> UIControl
        UIControl -->|"Scan command"| BusinessLogic
        BusinessLogic -->|"Retrieve web resources"| Dataverse
        BusinessLogic -->|"Retrieve flows"| PowerAutomate
        BusinessLogic -->|"Return scan results"| UIControl
        BusinessLogic -.->|"Write export file"| LocalIO
    end

    click Csproj "https://github.com/tihanajk/apireferencefinder/blob/main/APIReferenceFinder.csproj"
    click Sln "https://github.com/tihanajk/apireferencefinder/blob/main/APIReferenceFinder.sln"
    click Nuspec "https://github.com/tihanajk/apireferencefinder/blob/main/APIReferenceFinder.nuspec"
    click EntryPoint "https://github.com/tihanajk/apireferencefinder/blob/main/APIReferenceFinderPlugin.cs"
    click UIControl "https://github.com/tihanajk/apireferencefinder/blob/main/APIReferenceFinderPluginControl.cs"
    click UIControl "https://github.com/tihanajk/apireferencefinder/blob/main/APIReferenceFinderPluginControl.designer.cs"
    click UIControl "https://github.com/tihanajk/apireferencefinder/blob/main/APIReferenceFinderPluginControl.resx"
    click ConfigSettings "https://github.com/tihanajk/apireferencefinder/blob/main/Settings.cs"
    click AppConfig "https://github.com/tihanajk/apireferencefinder/blob/main/app.config"
    click ResourcesResx "https://github.com/tihanajk/apireferencefinder/blob/main/Properties/Resources.resx"
    click ResourcesDesigner "https://github.com/tihanajk/apireferencefinder/blob/main/Properties/Resources.Designer.cs"
    click AssemblyInfo "https://github.com/tihanajk/apireferencefinder/blob/main/Properties/AssemblyInfo.cs"
    click ImgButtons "https://github.com/tihanajk/apireferencefinder/tree/main/img/buttons/"
    click ImgLogo "https://github.com/tihanajk/apireferencefinder/tree/main/img/logo/"
    click Packages "https://github.com/tihanajk/apireferencefinder/blob/main/packages.config"
    click Readme "https://github.com/tihanajk/apireferencefinder/blob/main/README.md"
    click Draft "https://github.com/tihanajk/apireferencefinder/blob/main/MyToolDesign.excalidraw"

    classDef host fill:#cce5ff,stroke:#3399ff
    classDef plugin fill:#d4edda,stroke:#28a745
    classDef external fill:#fff3cd,stroke:#ffcc00
    classDef local fill:#e2e3e5,stroke:#6c757d
    classDef doc fill:#f8d7da,stroke:#dc3545
```
