430 lines
No EOL
13 KiB
JSON
430 lines
No EOL
13 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "Backend API for Veza platform.",
|
|
"title": "Veza Backend API",
|
|
"termsOfService": "http://swagger.io/terms/",
|
|
"contact": {
|
|
"name": "API Support",
|
|
"url": "http://www.veza.app/support",
|
|
"email": "support@veza.app"
|
|
},
|
|
"license": {
|
|
"name": "Apache 2.0",
|
|
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
|
},
|
|
"version": "1.2.0"
|
|
},
|
|
"host": "localhost:8080",
|
|
"basePath": "/api/v1",
|
|
"paths": {
|
|
"/api/v1/marketplace/download/{product_id}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a secure download URL for a purchased product",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Marketplace"
|
|
],
|
|
"summary": "Get download URL",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Product ID",
|
|
"name": "product_id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "No license",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/marketplace/orders": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Purchase products",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Marketplace"
|
|
],
|
|
"summary": "Create a new order",
|
|
"parameters": [
|
|
{
|
|
"description": "Order items",
|
|
"name": "order",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.CreateOrderRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/marketplace.Order"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/marketplace/products": {
|
|
"get": {
|
|
"description": "List marketplace products with filters",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Marketplace"
|
|
],
|
|
"summary": "List products",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Product status",
|
|
"name": "status",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Seller ID",
|
|
"name": "seller_id",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/marketplace.Product"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Create a product (Track, Pack, Service) for sale",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Marketplace"
|
|
],
|
|
"summary": "Create a new product",
|
|
"parameters": [
|
|
{
|
|
"description": "Product info",
|
|
"name": "product",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.CreateProductRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/marketplace.Product"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"handlers.CreateOrderRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"items"
|
|
],
|
|
"properties": {
|
|
"items": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"product_id"
|
|
],
|
|
"properties": {
|
|
"product_id": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"handlers.CreateProductRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"price",
|
|
"product_type",
|
|
"title"
|
|
],
|
|
"properties": {
|
|
"description": {
|
|
"type": "string",
|
|
"maxLength": 2000
|
|
},
|
|
"license_type": {
|
|
"type": "string",
|
|
"enum": [
|
|
"standard",
|
|
"exclusive",
|
|
"commercial"
|
|
]
|
|
},
|
|
"price": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"product_type": {
|
|
"type": "string",
|
|
"enum": [
|
|
"track",
|
|
"pack",
|
|
"service"
|
|
]
|
|
},
|
|
"title": {
|
|
"type": "string",
|
|
"maxLength": 200,
|
|
"minLength": 3
|
|
},
|
|
"track_id": {
|
|
"description": "UUID string",
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"marketplace.LicenseType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"basic",
|
|
"premium",
|
|
"exclusive"
|
|
],
|
|
"x-enum-varnames": [
|
|
"LicenseBasic",
|
|
"LicensePremium",
|
|
"LicenseExclusive"
|
|
]
|
|
},
|
|
"marketplace.Order": {
|
|
"type": "object",
|
|
"properties": {
|
|
"buyer_id": {
|
|
"type": "string"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"currency": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"items": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/marketplace.OrderItem"
|
|
}
|
|
},
|
|
"payment_intent": {
|
|
"description": "Stripe PaymentIntent ID",
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"description": "pending, paid, failed, refunded",
|
|
"type": "string"
|
|
},
|
|
"total_amount": {
|
|
"type": "number"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"marketplace.OrderItem": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"order_id": {
|
|
"type": "string"
|
|
},
|
|
"price": {
|
|
"type": "number"
|
|
},
|
|
"product_id": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"marketplace.Product": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"currency": {
|
|
"type": "string"
|
|
},
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"license_type": {
|
|
"$ref": "#/definitions/marketplace.LicenseType"
|
|
},
|
|
"price": {
|
|
"type": "number"
|
|
},
|
|
"product_type": {
|
|
"description": "\"track\", \"pack\", \"service\"",
|
|
"type": "string"
|
|
},
|
|
"seller_id": {
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/marketplace.ProductStatus"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"track_id": {
|
|
"description": "Liaison optionnelle avec un Track (si ProductType == \"track\")",
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"marketplace.ProductStatus": {
|
|
"type": "string",
|
|
"enum": [
|
|
"draft",
|
|
"active",
|
|
"archived"
|
|
],
|
|
"x-enum-varnames": [
|
|
"ProductStatusDraft",
|
|
"ProductStatusActive",
|
|
"ProductStatusArchived"
|
|
]
|
|
}
|
|
},
|
|
"securityDefinitions": {
|
|
"BearerAuth": {
|
|
"type": "apiKey",
|
|
"name": "Authorization",
|
|
"in": "header"
|
|
}
|
|
}
|
|
} |