harryagasi
feat(storage): add Supabase object storage and reduce exposed API surface
e4eafe1
Raw
History Blame Contribute Delete
86.6 kB
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {
"name": "Maintiva"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/login": {
"post": {
"description": "Verifikasi email dan password, lalu mengembalikan profil user, access_token Bearer 1 jam, dan refresh_token 7 hari.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Login user and issue token pair",
"parameters": [
{
"description": "Login credentials",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.loginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/auth.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/auth.AuthResult"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
}
}
}
},
"/api/refresh": {
"post": {
"description": "Menggunakan refresh_token aktif untuk menerbitkan access_token baru dan refresh_token pengganti. Refresh token lama tidak dapat dipakai ulang.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Rotate refresh token and issue token pair",
"parameters": [
{
"description": "Refresh token",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.refreshRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/auth.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/auth.AuthResult"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/auth.APIResponse"
}
}
}
}
},
"/api/v1/analyses": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mengembalikan daftar analysis milik authenticated user. Default status adalah active.",
"produces": [
"application/json"
],
"tags": [
"analyses"
],
"summary": "List analysis user",
"parameters": [
{
"enum": [
"active",
"inactive"
],
"type": "string",
"description": "Filter status: active atau inactive",
"name": "status",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "Nomor halaman",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 20,
"description": "Jumlah item per halaman, maksimal 100",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Membuat analysis aktif dengan business_questions dan minimal satu data source yang sudah dimiliki authenticated user.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"analyses"
],
"summary": "Buat analysis baru",
"parameters": [
{
"description": "Payload analysis baru",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.CreateAnalysisRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Analysis"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"409": {
"description": "Limit active analysis tercapai",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/analyses/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mengambil satu analysis berdasarkan ID dan authenticated user. Analysis milik user lain tidak akan dikembalikan.",
"produces": [
"application/json"
],
"tags": [
"analyses"
],
"summary": "Ambil detail analysis",
"parameters": [
{
"type": "string",
"description": "Analysis ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Analysis"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Menghapus analysis milik authenticated user.",
"produces": [
"application/json"
],
"tags": [
"analyses"
],
"summary": "Hapus analysis",
"parameters": [
{
"type": "string",
"description": "Analysis ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mengubah judul, objective, atau status analysis. Status hanya active atau inactive.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"analyses"
],
"summary": "Update metadata analysis",
"parameters": [
{
"type": "string",
"description": "Analysis ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Field yang ingin diubah",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.UpdateAnalysisRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Analysis"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/analyses/{id}/data-bind": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mengganti daftar data source yang ter-bind ke analysis secara atomic menggunakan expected_version. Minimal satu data source harus tersisa dan semua source harus milik authenticated user.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"analyses"
],
"summary": "Update data source binding analysis",
"parameters": [
{
"type": "string",
"description": "Analysis ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Versi dan daftar data source baru",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.UpdateDataBindRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Analysis"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"409": {
"description": "Stale version, inactive analysis, atau limit violation",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/analyses/{id}/data-catalog": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mengembalikan data catalog yang scoped ke analysis dan authenticated user. Catalog ini mengikuti data_bind analysis, bukan seluruh catalog user.",
"produces": [
"application/json"
],
"tags": [
"data-catalog"
],
"summary": "Ambil catalog data analysis",
"parameters": [
{
"type": "string",
"description": "Analysis ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/analyses/{id}/data-catalog/rebuild": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Membangun ulang data catalog scope analysis berdasarkan data_bind analysis milik authenticated user.",
"produces": [
"application/json"
],
"tags": [
"data-catalog"
],
"summary": "Rebuild catalog data analysis",
"parameters": [
{
"type": "string",
"description": "Analysis ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/analyses/{id}/messages": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mengambil riwayat percakapan analysis milik authenticated user dari analyses_messages.",
"produces": [
"application/json"
],
"tags": [
"analysis-messages"
],
"summary": "List pesan analysis",
"parameters": [
{
"type": "string",
"description": "Analysis ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 100,
"description": "Jumlah pesan, maksimal 100",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Menyimpan tepat satu pesan role=user atau role=ai ke analyses_messages. Endpoint ini tidak memanggil agentic backend dan tidak membuat balasan AI otomatis.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"analysis-messages"
],
"summary": "Tambah pesan conversation analysis",
"parameters": [
{
"type": "string",
"description": "Analysis ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Pesan conversation",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.CreateMessageRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"409": {
"description": "Analysis inactive",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/data-catalog/rebuild": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Reintrospect semua sumber data (DB clients + dokumen tabular) dan bangun ulang catalog",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"data-catalog"
],
"summary": "Rebuild seluruh catalog user",
"parameters": [
{
"description": "User ID",
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"user_id": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"429": {
"description": "Rate limit exceeded",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/data-catalog/{user_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mengembalikan index catalog (sources saja, tanpa detail tabel)",
"produces": [
"application/json"
],
"tags": [
"data-catalog"
],
"summary": "Ambil catalog data user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/database-clients": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Enkripsi credentials dan simpan. Jika sudah ada koneksi dengan identity yang sama, kembalikan yang existing (HTTP 200).",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"database-clients"
],
"summary": "Daftarkan koneksi database baru",
"parameters": [
{
"description": "Database connection info",
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"credentials": {
"type": "object"
},
"db_type": {
"type": "string"
},
"name": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Duplicate — returning existing",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/database_clients.DBClient"
}
}
}
]
}
},
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/database_clients.DBClient"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"429": {
"description": "Rate limit exceeded",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/database-clients/dbtypes": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mengembalikan semua tipe database beserta schema field yang dibutuhkan untuk membuat koneksi. Gunakan untuk render form dinamis di frontend.",
"produces": [
"application/json"
],
"tags": [
"database-clients"
],
"summary": "List tipe database yang didukung beserta definisi field kredensial",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/database_clients.DBTypeInfo"
}
}
}
}
]
}
}
}
}
},
"/api/v1/database-clients/{client_id}": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"database-clients"
],
"summary": "Update koneksi database",
"parameters": [
{
"type": "string",
"description": "Client ID",
"name": "client_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "User ID (ownership check)",
"name": "user_id",
"in": "query",
"required": true
},
{
"description": "Fields to update",
"name": "body",
"in": "body",
"schema": {
"type": "object",
"properties": {
"credentials": {
"type": "object"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/database_clients.DBClient"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Menghapus koneksi dan memicu pembersihan catalog",
"produces": [
"application/json"
],
"tags": [
"database-clients"
],
"summary": "Hapus koneksi database",
"parameters": [
{
"type": "string",
"description": "Client ID",
"name": "client_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "User ID (ownership check)",
"name": "user_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/database-clients/{client_id}/ingest": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"database-clients"
],
"summary": "Introspect schema database dan simpan ke catalog",
"parameters": [
{
"type": "string",
"description": "Client ID",
"name": "client_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "User ID (ownership check)",
"name": "user_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"409": {
"description": "Client is inactive",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"429": {
"description": "Rate limit exceeded",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/database-clients/{user_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"database-clients"
],
"summary": "List koneksi database milik user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/database_clients.DBClient"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/database-clients/{user_id}/{client_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"database-clients"
],
"summary": "Ambil detail satu koneksi database",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "user_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Client ID",
"name": "client_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/database_clients.DBClient"
}
}
}
]
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/document/delete": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Menghapus file dari object storage, embeddings, Parquet, dan record database",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"documents"
],
"summary": "Hapus dokumen",
"parameters": [
{
"description": "Document ID dan User ID",
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"document_id": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/document/process": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Processing berjalan di background. Response 202 dikembalikan segera setelah validasi. Pantau progress via GET /api/v1/documents/{user_id}.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"documents"
],
"summary": "Proses dokumen secara async (extract text / convert ke Parquet)",
"parameters": [
{
"description": "Document ID dan User ID",
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"document_id": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
}
}
],
"responses": {
"202": {
"description": "Accepted",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/documents.ProcessResult"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/document/upload": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Mendukung pdf, docx, txt, csv, xlsx. Maksimum 10 MB. Stream ke private object storage tanpa mengubah kontrak upload frontend.",
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"documents"
],
"summary": "Upload dokumen ke private object storage",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "user_id",
"in": "formData",
"required": true
},
{
"type": "file",
"description": "File dokumen",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/documents.Document"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/document/upload-local": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Sama seperti /upload tetapi menyimpan file ke folder files/ lokal. Digunakan untuk membandingkan performa vs private object storage.",
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"documents"
],
"summary": "Upload dokumen ke local filesystem (benchmarking)",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "user_id",
"in": "formData",
"required": true
},
{
"type": "file",
"description": "File dokumen",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/api/v1/documents/doctypes": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"documents"
],
"summary": "List tipe dokumen yang didukung",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/documents.DocTypeInfo"
}
}
}
}
]
}
}
}
}
},
"/api/v1/documents/{user_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"documents"
],
"summary": "List dokumen milik user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/api.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/documents.Document"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.APIResponse"
}
}
}
}
},
"/health": {
"get": {
"description": "Returns holistic readiness and dependency health for the service.",
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "Health check",
"responses": {
"200": {
"description": "Health report",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"503": {
"description": "Critical dependency unavailable",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
},
"definitions": {
"api.APIResponse": {
"type": "object",
"properties": {
"data": {},
"message": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"api.CreateAnalysisRequest": {
"type": "object",
"required": [
"analysis_title",
"business_questions",
"data_bind",
"objective"
],
"properties": {
"analysis_title": {
"type": "string"
},
"business_questions": {
"type": "array",
"items": {
"type": "string"
}
},
"data_bind": {
"type": "array",
"items": {
"$ref": "#/definitions/models.DataBindItem"
}
},
"objective": {
"type": "string"
}
}
},
"api.CreateMessageRequest": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"role": {
"type": "string"
}
}
},
"api.CreateSessionRequest": {
"type": "object",
"properties": {
"framework_id": {
"type": "string"
},
"language": {
"type": "string"
},
"mode": {
"type": "string"
},
"room_id": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"api.CreateSessionResponse": {
"type": "object",
"properties": {
"first_question": {
"type": "string"
},
"framework_id": {
"type": "string"
},
"opening_message": {
"type": "string"
},
"room_id": {
"type": "string"
},
"session_id": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"api.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
},
"api.FinishSessionResponse": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/api.InterviewResultDTO"
},
"room_id": {
"type": "string"
},
"session_id": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"api.InterviewResultDTO": {
"type": "object",
"properties": {
"ended_at": {
"type": "string"
},
"framework_name": {
"type": "string"
},
"goals": {
"type": "array",
"items": {
"type": "string"
}
},
"key_insights": {
"type": "array",
"items": {
"type": "string"
}
},
"language": {
"type": "string"
},
"mode": {
"type": "string"
},
"section_results": {
"type": "array",
"items": {
"$ref": "#/definitions/api.SectionResultDTO"
}
},
"started_at": {
"type": "string"
},
"summary": {
"type": "string"
},
"unresolved_items": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"api.QAPairDTO": {
"type": "object",
"properties": {
"answer_cleaned": {
"type": "string"
},
"follow_ups": {
"type": "array",
"items": {
"$ref": "#/definitions/api.QAPairDTO"
}
},
"question_text": {
"type": "string"
}
}
},
"api.RoomSessionResponse": {
"type": "object",
"properties": {
"framework_id": {
"type": "string"
},
"framework_name": {
"type": "string"
},
"language": {
"type": "string"
},
"mode": {
"type": "string"
},
"room_id": {
"type": "string"
},
"session_id": {
"type": "string"
},
"started_at": {
"type": "string"
},
"status": {
"type": "string"
},
"turns": {
"type": "array",
"items": {
"$ref": "#/definitions/api.TurnDTO"
}
}
}
},
"api.SectionResultDTO": {
"type": "object",
"properties": {
"objective": {
"type": "array",
"items": {
"type": "string"
}
},
"qa_pairs": {
"type": "array",
"items": {
"$ref": "#/definitions/api.QAPairDTO"
}
},
"section_summary": {
"type": "string"
},
"section_title": {
"type": "string"
}
}
},
"api.SendTextRequest": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"api.SendTextResponse": {
"type": "object",
"properties": {
"finished": {
"type": "boolean"
},
"reply": {
"type": "string"
},
"stage": {
"type": "string"
}
}
},
"api.TurnDTO": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"speaker": {
"type": "string"
},
"text": {
"type": "string"
}
}
},
"api.UpdateAnalysisRequest": {
"type": "object",
"properties": {
"analysis_title": {
"type": "string"
},
"objective": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"api.UpdateDataBindRequest": {
"type": "object",
"properties": {
"data_bind": {
"type": "array",
"items": {
"$ref": "#/definitions/models.DataBindItem"
}
},
"expected_version": {
"type": "integer"
}
}
},
"auth.APIResponse": {
"type": "object",
"properties": {
"data": {},
"message": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"auth.AuthResult": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"refresh_expires_in": {
"type": "integer"
},
"refresh_token": {
"type": "string"
},
"token_type": {
"type": "string"
},
"user": {
"$ref": "#/definitions/auth.User"
}
}
},
"auth.User": {
"type": "object",
"properties": {
"company": {
"type": "string"
},
"company_size": {
"type": "string"
},
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"fullname": {
"type": "string"
},
"function": {
"type": "string"
},
"id": {
"type": "string"
},
"role": {
"type": "string"
},
"site": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"auth.loginRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"auth.refreshRequest": {
"type": "object",
"properties": {
"refresh_token": {
"type": "string"
}
}
},
"database_clients.DBClient": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"credentials": {
"type": "object",
"additionalProperties": {}
},
"db_type": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"database_clients.DBFieldDef": {
"type": "object",
"properties": {
"default": {},
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"options": {
"type": "array",
"items": {
"type": "string"
}
},
"required": {
"type": "boolean"
},
"sensitive": {
"type": "boolean"
},
"type": {
"type": "string"
}
}
},
"database_clients.DBTypeInfo": {
"type": "object",
"properties": {
"db_type": {
"type": "string"
},
"display_name": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"$ref": "#/definitions/database_clients.DBFieldDef"
}
},
"logo": {
"type": "string"
},
"message": {
"type": "string"
},
"status": {
"description": "active | inactive",
"type": "string"
}
}
},
"documents.DocTypeInfo": {
"type": "object",
"properties": {
"max_size_mb": {
"type": "integer"
},
"message": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive"
]
},
"type": {
"type": "string"
}
}
},
"documents.Document": {
"type": "object",
"properties": {
"blob_name": {
"type": "string"
},
"chunks_count": {
"type": "integer"
},
"created_at": {
"type": "string"
},
"error_message": {
"type": "string"
},
"file_size": {
"type": "integer"
},
"file_type": {
"type": "string"
},
"filename": {
"type": "string"
},
"id": {
"type": "string"
},
"processed_at": {
"type": "string"
},
"status": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"documents.ProcessResult": {
"type": "object",
"properties": {
"document_id": {
"type": "string"
},
"file_type": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"models.Analysis": {
"type": "object",
"properties": {
"analysis_title": {
"type": "string"
},
"business_questions": {
"type": "array",
"items": {
"type": "string"
}
},
"created_at": {
"type": "string"
},
"data_bind": {
"type": "array",
"items": {
"$ref": "#/definitions/models.DataBindItem"
}
},
"data_bind_version": {
"type": "integer"
},
"id": {
"type": "string"
},
"objective": {
"type": "string"
},
"report_collection": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ReportCollectionItem"
}
},
"report_id": {
"type": "string"
},
"status": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"models.DataBindItem": {
"type": "object",
"properties": {
"group_type": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"models.Report": {
"type": "object",
"properties": {
"analysis_id": {
"type": "string"
},
"content": {
"type": "string"
},
"generated_at": {
"type": "string"
},
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"user_id": {
"type": "string"
},
"version": {
"type": "integer"
}
}
},
"models.ReportCollectionItem": {
"type": "object",
"properties": {
"generated_at": {
"type": "string"
},
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"version": {
"type": "integer"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "Type \"Bearer \" followed by a valid access token from /api/login or /api/refresh.",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:8081",
BasePath: "/",
Schemes: []string{},
Title: "Orchestrator Agent API",
Description: "Backend service untuk Analysis, documents, database clients, catalog, auth, and knowledge ingestion endpoints.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}