# lalamove/api-examples architecture

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

- Interactive diagram: https://gitdiagram.com/lalamove/api-examples
- Repository: https://github.com/lalamove/api-examples

## Overview

##### Main Components

a) Client SDKs Layer:
- Different language implementations (Java, Node.js, PHP, Python, Ruby, Go, C#)
- That each language has two main functionalities: Order and Quotation
- Version differences (v2 and v3) where applicable

b) Lalamove API Layer:
- REST API endpoints
- Authentication system (using API key and secret)
- Core services (Order and Quotation)

**[Client Applications]**
- ↓
**[Language-Specific SDKs]**
- ↓
**[Authentication Layer]**
- ↓
**[Lalamove REST API]**

##### Specific Elements

- Version bifurcation where applicable (v2/v3)
- Two main classes/files for each:
- Order implementation
- Quotation implementation

b) Authentication Component:
- API key and secret handling
- Credential flow

c) API Interface:
- REST endpoints for Order and Quotation services
- HTTP methods and basic request/response flow

##### Important Details to Capture

- That all implementations follow the same pattern
- Version differences in Java, Node.js, and PHP
- That all SDKs communicate with the same API endpoints
- Authentication flow that's common across all implementations

##### The two main functionalities (Order and Quotation)

Remember to maintain consistency in the representation of similar components across different languages while clearly showing the version variations where they exist.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Applications"]
        App1[Client App 1]
        App2[Client App 2]
        App3[Client App 3]
    end

    subgraph SDKs["Language-Specific SDKs"]
        subgraph Java["Java Implementation"]
            JavaV2["Java SDK v2"]:::java
            JavaV2Order["Order v2"]:::java
            JavaV2Quote["Quotation v2"]:::java
            JavaV3["Java SDK v3"]:::java
            JavaV3Order["Order v3"]:::java
            JavaV3Quote["Quotation v3"]:::java
        end

        subgraph Node["Node.js Implementation"]
            NodeV2["Node.js SDK v2"]:::nodejs
            NodeV2Order["Order v2"]:::nodejs
            NodeV2Quote["Quotation v2"]:::nodejs
            NodeV3["Node.js SDK v3"]:::nodejs
            NodeV3Order["Order v3"]:::nodejs
            NodeV3Quote["Quotation v3"]:::nodejs
        end

        subgraph PHP["PHP Implementation"]
            PHPV2["PHP SDK v2"]:::php
            PHPV2Order["Order v2"]:::php
            PHPV2Quote["Quotation v2"]:::php
            PHPV3["PHP SDK v3"]:::php
            PHPV3Order["Order v3"]:::php
            PHPV3Quote["Quotation v3"]:::php
        end

        subgraph Other["Other Languages"]
            Python["Python SDK"]:::python
            PythonOrder["Order"]:::python
            PythonQuote["Quotation"]:::python
            
            Ruby["Ruby SDK"]:::ruby
            RubyOrder["Order"]:::ruby
            RubyQuote["Quotation"]:::ruby
            
            Go["Go SDK"]:::go
            GoOrder["Order"]:::go
            GoQuote["Quotation"]:::go
            
            CSharp["C# SDK"]:::csharp
            CSharpOrder["Order"]:::csharp
            CSharpQuote["Quotation"]:::csharp
        end
    end

    subgraph Auth["Authentication Layer"]
        APIKey["API Key"]
        Secret["Secret Key"]
        AuthFlow{"Authentication"}
    end

    subgraph API["Lalamove REST API"]
        OrderAPI["Order Endpoints"]
        QuoteAPI["Quotation Endpoints"]
    end

    %% Connections
    App1 & App2 & App3 --> SDKs
    
    %% Java Connections
    JavaV2 --> JavaV2Order & JavaV2Quote
    JavaV3 --> JavaV3Order & JavaV3Quote
    
    %% Node.js Connections
    NodeV2 --> NodeV2Order & NodeV2Quote
    NodeV3 --> NodeV3Order & NodeV3Quote
    
    %% PHP Connections
    PHPV2 --> PHPV2Order & PHPV2Quote
    PHPV3 --> PHPV3Order & PHPV3Quote
    
    %% Other Languages Connections
    Python --> PythonOrder & PythonQuote
    Ruby --> RubyOrder & RubyQuote
    Go --> GoOrder & GoQuote
    CSharp --> CSharpOrder & CSharpQuote
    
    %% Auth and API Connections
    SDKs --> APIKey & Secret
    APIKey & Secret --> AuthFlow
    AuthFlow --> OrderAPI & QuoteAPI

    %% Click Events
    click JavaV2Order "https://github.com/lalamove/api-examples/blob/master/java/v2/Order.java"
    click JavaV2Quote "https://github.com/lalamove/api-examples/blob/master/java/v2/Quotation.java"
    click JavaV3Order "https://github.com/lalamove/api-examples/blob/master/java/v3/Order.java"
    click JavaV3Quote "https://github.com/lalamove/api-examples/blob/master/java/v3/Quotation.java"
    
    click NodeV2Order "https://github.com/lalamove/api-examples/blob/master/nodejs/order-v2.js"
    click NodeV2Quote "https://github.com/lalamove/api-examples/blob/master/nodejs/quotation-v2.js"
    click NodeV3Order "https://github.com/lalamove/api-examples/blob/master/nodejs/order-v3.js"
    click NodeV3Quote "https://github.com/lalamove/api-examples/blob/master/nodejs/quotation-v3.js"
    
    click PHPV2Order "https://github.com/lalamove/api-examples/blob/master/php/order-v2.php"
    click PHPV2Quote "https://github.com/lalamove/api-examples/blob/master/php/quotation-v2.php"
    click PHPV3Order "https://github.com/lalamove/api-examples/blob/master/php/order-v3.php"
    click PHPV3Quote "https://github.com/lalamove/api-examples/blob/master/php/quotation-v3.php"
    
    click PythonOrder "https://github.com/lalamove/api-examples/blob/master/python/order.py"
    click PythonQuote "https://github.com/lalamove/api-examples/blob/master/python/quotation.py"
    
    click RubyOrder "https://github.com/lalamove/api-examples/blob/master/ruby/order.rb"
    click RubyQuote "https://github.com/lalamove/api-examples/blob/master/ruby/quotation.rb"
    
    click GoOrder "https://github.com/lalamove/api-examples/blob/master/go/order.go"
    click GoQuote "https://github.com/lalamove/api-examples/blob/master/go/quotation.go"
    
    click CSharpOrder "https://github.com/lalamove/api-examples/blob/master/c_sharp/order.cs"
    click CSharpQuote "https://github.com/lalamove/api-examples/blob/master/c_sharp/quotation.cs"

    %% Styles
    classDef java fill:#b07219,color:white
    classDef nodejs fill:#f1e05a,color:black
    classDef php fill:#4F5D95,color:white
    classDef python fill:#3572A5,color:white
    classDef ruby fill:#701516,color:white
    classDef go fill:#00ADD8,color:white
    classDef csharp fill:#178600,color:white
    classDef api fill:#FF6B6B,color:white
```
