# romailchyshyn/api-basic-homework architecture

> Architecture diagram of the GitHub repository romailchyshyn/api-basic-homework, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/romailchyshyn/api-basic-homework
- Repository: https://github.com/romailchyshyn/api-basic-homework

## Overview

This repository is a Java API automation client for authentication and promo-code activation. Its principal workflow builds an authentication request, sends it to the stage API, and exposes the response for verification or token extraction. A second documented-by-code capability is authenticated promo-code activation. Source excerpts confirm the auth facade/service/client path and token helper; the API v2 facade and several model implementations were not sampled, so their wiring is not asserted.

Main entry points: [`src/main/java/business/auth/AuthApiFacade.java`](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/business/auth/AuthApiFacade.java) (Auth facade), [`src/main/java/client/RestClient.java`](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/client/RestClient.java) (REST client), [`src/main/java/service/AuthService.java`](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/service/AuthService.java) (Auth service), [`src/main/java/bussiness/apiv2/ApiV2Facade.java`](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/bussiness/apiv2/ApiV2Facade.java) (API v2 facade)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflows["API workflows"]
  node_auth_facade["Auth facade<br/>[AuthApiFacade.java]"]
  node_auth_service["Auth service<br/>[AuthService.java]"]
  node_apiv2_facade["API v2 facade<br/>[ApiV2Facade.java]"]
  node_apiv2_service["API v2 service<br/>[ApiV2Service.java]"]
end

subgraph group_transport["HTTP transport"]
  node_rest_client["REST client<br/>[RestClient.java]"]
end

subgraph group_contracts["Request and response models"]
  node_login_request["Login request"]
  node_register_request["Registration request"]
  node_login_response["Login response"]
  node_register_response["Registration response"]
  node_activate_request["Promo activation request"]
  node_activate_response["Promo activation response"]
  node_not_found_response["Promo not found response"]
end

subgraph group_support["Workflow support"]
  node_token_helper["Token helper"]
  node_auth_test_data["Auth test data<br/>[AuthTestData.java]"]
  node_test_user["Test user<br/>[TestUser.java]"]
  node_constants["Constants"]
end

node_caller(("Test caller"))
node_stage_api(("Stage API"))

node_caller -->|"submits auth"| node_auth_facade
node_auth_facade -->|"calls"| node_auth_service
node_auth_service -->|"sends request"| node_rest_client
node_rest_client -->|"HTTP request"| node_stage_api
node_stage_api -->|"HTTP response"| node_rest_client
node_rest_client -->|"returns response"| node_auth_service
node_auth_service -->|"returns response"| node_auth_facade
node_auth_facade -->|"verifies response"| node_caller
node_caller -->|"requests activation"| node_apiv2_facade
node_apiv2_service -->|"sends request"| node_rest_client
node_rest_client -->|"returns response"| node_apiv2_service
node_token_helper -->|"builds request"| node_auth_test_data
node_auth_test_data -->|"uses user"| node_test_user
node_auth_test_data -->|"reads defaults"| node_constants
node_token_helper -->|"registers user"| node_auth_facade
node_auth_facade -->|"accepts request"| node_register_request
node_auth_facade -->|"accepts request"| node_login_request
node_auth_facade -->|"parses response"| node_login_response
node_auth_facade -->|"parses response"| node_register_response
node_apiv2_service -->|"accepts request"| node_activate_request
node_apiv2_facade -->|"response contract"| node_activate_response
node_apiv2_facade -->|"error contract"| node_not_found_response

click node_auth_facade "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/business/auth/AuthApiFacade.java"
click node_auth_service "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/service/AuthService.java"
click node_apiv2_facade "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/bussiness/apiv2/ApiV2Facade.java"
click node_apiv2_service "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/service/ApiV2Service.java"
click node_rest_client "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/client/RestClient.java"
click node_login_request "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/request/auth/AuthLoginRequest.java"
click node_register_request "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/request/auth/AuthRegisterRequest.java"
click node_login_response "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/response/auth/AuthLoginResponse.java"
click node_register_response "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/response/auth/AuthRegisterResponse.java"
click node_activate_request "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/request/apiv2/ActivatePromocodeRequest.java"
click node_activate_response "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/response/apiv2/ActivatePromocodeResponse.java"
click node_not_found_response "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/response/apiv2/PromocodeNotFoundResponse.java"
click node_token_helper "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/helpers/GetTokenHelper.java"
click node_auth_test_data "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/data/AuthTestData.java"
click node_test_user "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/data/TestUser.java"
click node_constants "https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/constants/ConstantStorage.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_facade,node_auth_service,node_apiv2_facade,node_apiv2_service toneBlue
class node_rest_client toneAmber
class node_login_request,node_register_request,node_login_response,node_register_response,node_activate_request,node_activate_response,node_not_found_response,node_stage_api toneMint
class node_token_helper,node_auth_test_data,node_test_user,node_constants toneRose
class node_caller toneIndigo
```

## Components

### API workflows

- [Auth facade](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/business/auth/AuthApiFacade.java): `src/main/java/business/auth/AuthApiFacade.java`
- [Auth service](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/service/AuthService.java): `src/main/java/service/AuthService.java`
- [API v2 facade](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/bussiness/apiv2/ApiV2Facade.java): `src/main/java/bussiness/apiv2/ApiV2Facade.java`
- [API v2 service](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/service/ApiV2Service.java): `src/main/java/service/ApiV2Service.java`

### HTTP transport

- [REST client](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/client/RestClient.java): `src/main/java/client/RestClient.java`

### Request and response models

- [Login request](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/request/auth/AuthLoginRequest.java): `src/main/java/models/request/auth/AuthLoginRequest.java`
- [Registration request](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/request/auth/AuthRegisterRequest.java): `src/main/java/models/request/auth/AuthRegisterRequest.java`
- [Login response](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/response/auth/AuthLoginResponse.java): `src/main/java/models/response/auth/AuthLoginResponse.java`
- [Registration response](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/response/auth/AuthRegisterResponse.java): `src/main/java/models/response/auth/AuthRegisterResponse.java`
- [Promo activation request](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/request/apiv2/ActivatePromocodeRequest.java): `src/main/java/models/request/apiv2/ActivatePromocodeRequest.java`
- [Promo activation response](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/response/apiv2/ActivatePromocodeResponse.java): `src/main/java/models/response/apiv2/ActivatePromocodeResponse.java`
- [Promo not found response](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/models/response/apiv2/PromocodeNotFoundResponse.java): `src/main/java/models/response/apiv2/PromocodeNotFoundResponse.java`

### Workflow support

- [Token helper](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/helpers/GetTokenHelper.java): `src/main/java/helpers/GetTokenHelper.java`
- [Auth test data](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/data/AuthTestData.java): `src/main/java/data/AuthTestData.java`
- [Test user](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/data/TestUser.java): `src/main/java/data/TestUser.java`
- [Constants](https://github.com/romailchyshyn/api-basic-homework/blob/main/src/main/java/constants/ConstantStorage.java): `src/main/java/constants/ConstantStorage.java`

### Other components

- **Test caller**
- **Stage API**

## Connections

- Test caller → Auth facade: submits auth
- Auth facade → Auth service: calls
- Auth service → REST client: sends request
- REST client → Stage API: HTTP request
- Stage API → REST client: HTTP response
- REST client → Auth service: returns response
- Auth service → Auth facade: returns response
- Auth facade → Test caller: verifies response
- Test caller → API v2 facade: requests activation
- API v2 service → REST client: sends request
- REST client → API v2 service: returns response
- Token helper → Auth test data: builds request
- Auth test data → Test user: uses user
- Auth test data → Constants: reads defaults
- Token helper → Auth facade: registers user
- Auth facade → Registration request: accepts request
- Auth facade → Login request: accepts request
- Auth facade → Login response: parses response
- Auth facade → Registration response: parses response
- API v2 service → Promo activation request: accepts request
- API v2 facade → Promo activation response: response contract
- API v2 facade → Promo not found response: error contract
