# sreeise/graph-rs-sdk architecture

> Architecture diagram of the GitHub repository sreeise/graph-rs-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sreeise/graph-rs-sdk
- Repository: https://github.com/sreeise/graph-rs-sdk

## Overview

##### Main Components Overview

a) Client Layer:
- GraphClient (main entry point)
- Blocking and Async clients
- Request builders and handlers

b) Authentication Layer:
- OAuth2 implementations
- Token management
- Identity platform integrations
- Interactive authentication components

c) Core Infrastructure:
- HTTP client implementation
- Request/Response handling
- Error management
- Serialization/Deserialization

d) API Implementation Layer:
- Generated API endpoints
- Resource implementations
- Method builders

##### Key Relationships to Highlight

**Client Layer → Authentication Layer**
- ↓
**Core Infrastructure**
- ↓
**API Implementation Layer**

##### Detailed Component Breakdown

a) Client Layer Components:
- To subcomponents:
- Request Builders
- Blocking Client
- Async Client
- Batch Request Handler

b) Authentication Components:
- OAuth2 Flow Handlers
- Authorization Code
- Client Credentials
- Device Code
- Interactive Auth
- Token Management
- Token Cache
- Refresh Handlers
- Identity Platform
- Credential Builders
- Application Builders

c) Core Infrastructure:
- HTTP Client
- Request Pipeline
- Response Handlers
- Error Handlers
- Serialization Layer

d) API Implementation:
- Resource Endpoints
- Method Builders
- Request Formatters
- Response Parsers

##### Special Features to Highlight

Create dedicated sections for:
- Paging Implementation
- Stream Support
- Channel Support
- Delta Query Support
- File Operations
- Upload Sessions
- Download Handlers
- Batch Operations
- OData Query Builder

##### Component Interactions

- API Request Flow
- Authentication Flow
- File Operation Flow
- Paging Operation Flow

##### Technical Details

Annotations for:
- Async/Blocking boundaries
- Error propagation paths
- Token refresh flows
- Request/Response transformation points

##### External Dependencies

Integration points with:
- Microsoft Graph API
- OAuth2 endpoints
- Identity Platform services
- Storage systems (for token cache)

##### Implementation Notes

Callouts for:
- Feature flag dependencies
- Platform-specific components
- Optional functionality
- Extension points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        GC[GraphClient]
        RB[Request Builders]
        BC[Blocking Client]
        AC[Async Client]
        BH[Batch Handler]
    end

    subgraph Auth
        OAuth[OAuth2 Flows]
        TM[Token Management]
        IP[Identity Platform]
        IA[Interactive Auth]
    end

    subgraph Core
        HC[HTTP Client]
        RP[Request Pipeline]
        RH[Response Handlers]
        EH[Error Handlers]
        SL[Serialization Layer]
    end

    subgraph API
        RE[Resource Endpoints]
        MB[Method Builders]
        RF[Request Formatters]
        RP2[Response Parsers]
    end

    subgraph Features
        PI[Paging Implementation]
        FO[File Operations]
        BO[Batch Operations]
        QB[OData Query Builder]
    end

    GC --> RB
    GC --> BC
    GC --> AC
    GC --> BH

    Client --> Auth
    Client --> Core
    Core --> API

    Auth --> OAuth
    Auth --> TM
    Auth --> IP
    Auth --> IA

    Core --> HC
    Core --> RP
    Core --> RH
    Core --> EH
    Core --> SL

    API --> RE
    API --> MB
    API --> RF
    API --> RP2

    Features --> PI
    Features --> FO
    Features --> BO
    Features --> QB

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef client fill:#b3d9ff
    classDef auth fill:#90EE90
    classDef core fill:#FFB366
    classDef api fill:#DDA0DD
    classDef features fill:#FFD700

    class GC,RB,BC,AC,BH client
    class OAuth,TM,IP,IA auth
    class HC,RP,RH,EH,SL core
    class RE,MB,RF,RP2 api
    class PI,FO,BO,QB features

    click GC "https://github.com/sreeise/graph-rs-sdk/blob/master/src/client/graph.rs"
    click RB "https://github.com/sreeise/graph-rs-sdk/blob/master/src/client/mod.rs"
    click OAuth "https://github.com/sreeise/graph-rs-sdk/tree/master/graph-oauth/src/"
    click TM "https://github.com/sreeise/graph-rs-sdk/blob/master/graph-core/src/cache/token_cache.rs"
    click IP "https://github.com/sreeise/graph-rs-sdk/tree/master/graph-oauth/src/identity/"
    click IA "https://github.com/sreeise/graph-rs-sdk/tree/master/graph-oauth/src/interactive/"
    click HC "https://github.com/sreeise/graph-rs-sdk/tree/master/graph-http/src/"
    click EH "https://github.com/sreeise/graph-rs-sdk/tree/master/graph-error/src/"
    click RH "https://github.com/sreeise/graph-rs-sdk/blob/master/graph-http/src/traits/response_ext.rs"
    click RE "https://github.com/sreeise/graph-rs-sdk/tree/master/src/"
    click BO "https://github.com/sreeise/graph-rs-sdk/tree/master/src/batch/"
    click FO "https://github.com/sreeise/graph-rs-sdk/tree/master/graph-http/src/upload_session/"
    click PI "https://github.com/sreeise/graph-rs-sdk/blob/master/graph-http/src/traits/odata_query.rs"

    %% Legend
    subgraph Legend
        L1[Client Layer]:::client
        L2[Auth Layer]:::auth
        L3[Core Layer]:::core
        L4[API Layer]:::api
        L5[Features]:::features
    end
```
