Initial commit

This commit is contained in:
2026-01-19 12:12:29 +07:00
commit 2072052437
42 changed files with 5450 additions and 0 deletions

518
docs/swagger.json Normal file
View File

@@ -0,0 +1,518 @@
{
"swagger": "2.0",
"info": {
"description": "This is the API server for Stream application.",
"title": "Stream API",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "localhost:8080",
"basePath": "/",
"paths": {
"/payments": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a new payment",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"payment"
],
"summary": "Create Payment",
"parameters": [
{
"description": "Payment Info",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/payment.CreatePaymentRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/plans": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get all active plans",
"produces": [
"application/json"
],
"tags": [
"plan"
],
"summary": "List Plans",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Plan"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/videos": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get paginated videos",
"produces": [
"application/json"
],
"tags": [
"video"
],
"summary": "List Videos",
"parameters": [
{
"type": "integer",
"default": 1,
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Page size",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create video record after upload",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"video"
],
"summary": "Create Video",
"parameters": [
{
"description": "Video Info",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/video.CreateVideoRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Video"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/videos/upload-url": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Generate presigned URL for video upload",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"video"
],
"summary": "Get Upload URL",
"parameters": [
{
"description": "File Info",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/video.UploadURLRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/videos/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get video details by ID",
"produces": [
"application/json"
],
"tags": [
"video"
],
"summary": "Get Video",
"parameters": [
{
"type": "string",
"description": "Video ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Video"
}
}
}
]
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
}
},
"definitions": {
"model.Plan": {
"type": "object",
"properties": {
"cycle": {
"type": "string"
},
"description": {
"type": "string"
},
"duration_limit": {
"type": "integer"
},
"features": {
"type": "string"
},
"id": {
"type": "string"
},
"is_active": {
"type": "boolean"
},
"name": {
"type": "string"
},
"price": {
"type": "number"
},
"quality_limit": {
"type": "string"
},
"storage_limit": {
"type": "integer"
},
"upload_limit": {
"type": "integer"
}
}
},
"model.Video": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"duration": {
"type": "integer"
},
"format": {
"type": "string"
},
"hls_path": {
"type": "string"
},
"hls_token": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"processing_status": {
"type": "string"
},
"size": {
"type": "integer"
},
"status": {
"type": "string"
},
"storage_type": {
"type": "string"
},
"thumbnail": {
"type": "string"
},
"title": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"url": {
"type": "string"
},
"user_id": {
"type": "string"
},
"views": {
"type": "integer"
}
}
},
"payment.CreatePaymentRequest": {
"type": "object",
"required": [
"amount",
"plan_id"
],
"properties": {
"amount": {
"type": "number"
},
"plan_id": {
"type": "string"
}
}
},
"response.Response": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {},
"message": {
"type": "string"
}
}
},
"video.CreateVideoRequest": {
"type": "object",
"required": [
"size",
"title",
"url"
],
"properties": {
"description": {
"type": "string"
},
"duration": {
"description": "Maybe client knows, or we process later",
"type": "integer"
},
"format": {
"type": "string"
},
"size": {
"type": "integer"
},
"title": {
"type": "string"
},
"url": {
"description": "The S3 Key or Full URL",
"type": "string"
}
}
},
"video.UploadURLRequest": {
"type": "object",
"required": [
"content_type",
"filename",
"size"
],
"properties": {
"content_type": {
"type": "string"
},
"filename": {
"type": "string"
},
"size": {
"type": "integer"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}