# :stadium: Motoverse
###### tags: `customer`
## Sample Data
Request Ids :
1. request-id-1 - success
2. request-id-2 - failure
3. request-id-3 - pending
## Media Priority
* Priority 0 : Three videos in request
* Priority 1 : Two videos and 1 image in request
* Priority 2 : 1 video and 2 images in request
* Priority 3 : Three images in request
* Priority 4 : two media in request will be appended by generic media
* Priority 5 : 1 media in request will be appended by 2 generic media
### SOP
1. First two seconds of videos will be used in case video is of longer length
2. Any media more than 3 will be ignored
3. Video should be in vertical format. In case they are in horizontal format, they will be transformed
4. 15 seconds videos, 720P??
## API
source IP need to be white list - Sunil please check API gateway
### New Video
URL : https://api.whilter.ai/video
Request : POST
Header : API-KEY
### Request
```json
{
"request-identifier" : "client-unique-key",
"timestamp" : "12123303",
"template-id": "<template-uuid>",
"user-id": "<user-id>",
"user-text" : [
"User specific text 1",
"User specific text 2"
],
"image-urls" : [
"https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/images/image1.jpeg",
"https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/images/image2.jpeg",
"https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/images/image3.jpeg"
],
"video-urls" : [
"https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/videos/video1.mov",
"https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/videos/video2.mov",
"https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/videos/video3.mov"
]
}
```
#### Ingestion Service config
```json
{
// mapping
}
```
Transaction Event from API Ingestion
```json
{
"request-identifier" : "client-unique-key",
"timestamp" : "12123303",
"template-id": "<template-uuid>",
"user-id": "<user-id>",
"image-url-1" : "https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/images/image1.jpeg",
"image-url-2" : "https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/images/image2.jpeg",
"image-url-3" : "https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/images/image3.jpeg",
"video-url-1" : "https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/videos/video1.mov",
"video-url-2" : "https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/videos/video2.mov",
"video-url-3" : "https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/videos/video3.mov"
}
```
#### Downlaoder Service config
```json
{
"base-path" : "/whilter"
}
```
Transaction Event from API Downlaoder Service
```json
{
"request-identifier" : "client-unique-key",
"timestamp" : "12123303",
"template-id": "<template-uuid>",
"user-id": "<user-id>",
"image-file-path-1" : "/whilter/client_key/template/image-1.jpeg",
"image-file-path-2" : "/whilter/client_key/template/image-2.jpeg",
"image-file-path-3" : "/whilter/client_key/template/image-3.jpeg",
"video-file-path-1" : "/whilter/client_key/template/video1.mov",
"video-file-path-2" : "/whilter/client_key/template/video2.mov",
"video-file-path-3" : "/whilter/client_key/template/video3.mov"
}
```
### Response
Success
```json
{
"request-identifier" : "client-unique-key",
"status" : "202"
}
```
Failure
```json
{
"request-identifier" : "client-unique-key",
"status" : "40X"
}
```
## Video Status Client
URL : https://api.whilter.ai/video-status/client/{client-unique-key}
Request : GET
Header : API-KEY
### Response
Success
```json
{
"request-identifier" : "client-unique-key",
"status" : "200",
"state" : "success",
"video-url" : "https://amplify-whilter-dev--193849-deployment.s3.ap-south-1.amazonaws.com/videos/final-video.mp4"
}
```
In Process
```json
{
"request-identifier" : "client-unique-key",
"status" : "200",
"state" : "pending"
}
```
## Whilter Public Service
### Request Table
Request(APIKey, TemplateKey, UserKey, Other fields)+Status+VideoFinalURL (MongoDB/DDB)
### API Logic
First Validate if not exist
Then Create Brain Event
Else Respond accordingly
## Whilter Downloader Service
Download assets in brain event to local pvc
folder per apikey > template key > user key