Restructure the monorepo into clear top-level directories: - backend/: Go module root (cmd, internal, pkg, configs, migrations, docs/swagger, scripts, tests, go.mod, Makefile, .air.toml) - deploy/: Docker (Dockerfile, docker-compose*), quickstart, fluentd - docs/: project documentation + reports/ (moved from repo root) - AGENTS.md: new AI coding-agent guide at repo root Update all references to the new layout: - Dockerfile: COPY backend/go.mod, COPY backend/ (context = repo root) - docker-compose files: context ../.., dockerfile deploy/docker/Dockerfile, env_file ../../.env, volume mounts ../../backend:/app - deploy/quickstart/compose.yaml: dockerfile deploy/docker/Dockerfile - CI: working-directory: backend for go commands, file deploy/docker/Dockerfile, coverage path backend/coverage.out, health_check backend/scripts/ - backend/Makefile: docker target uses -f ../deploy/docker/Dockerfile ../ - README: architecture tree, quickstart, config paths updated Move root stray scripts (rename_models.*, run_m11_tests.sh, verify_build.sh, gorm_bool_main.go) to backend/scripts/legacy/. All moves via git mv to preserve history. Build, vet, SQLite tests, and docker compose config verified.
3530 lines
123 KiB
Go
3530 lines
123 KiB
Go
// 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": {},
|
|
"version": "{{.Version}}"
|
|
},
|
|
"host": "{{.Host}}",
|
|
"basePath": "{{.BasePath}}",
|
|
"paths": {
|
|
"/api/v1/accounts": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Returns all accounts the authenticated user has access to, with pagination support",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Accounts"
|
|
],
|
|
"summary": "List accounts accessible by the current user",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Account"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Creates a new account and assigns the creator as administrator",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Accounts"
|
|
],
|
|
"summary": "Create a new account",
|
|
"parameters": [
|
|
{
|
|
"description": "Account creation payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.CreateAccountRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Account"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves all conversations for an account with pagination, optionally filtered by status query param",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Conversations"
|
|
],
|
|
"summary": "List conversations for an account",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Filter by conversation status (open/pending/resolved/snoozed)",
|
|
"name": "status",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Conversation"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/search": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Searches conversations by query string with pagination and search mode support",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Conversations"
|
|
],
|
|
"summary": "Search conversations",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Search query",
|
|
"name": "q",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "prefix",
|
|
"description": "Search mode (prefix/semantic/fulltext)",
|
|
"name": "search_mode",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Conversation"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves all messages for a conversation with pagination",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Messages"
|
|
],
|
|
"summary": "List messages in a conversation",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "conversation_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Message"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Creates a new message in an existing conversation",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Messages"
|
|
],
|
|
"summary": "Create a message in a conversation",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "conversation_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Message creation payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.CreateMessageRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Message"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages/{id}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves detailed information about a specific message",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Messages"
|
|
],
|
|
"summary": "Get a single message",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "conversation_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Message ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Message"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Soft-deletes a message from a conversation",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Messages"
|
|
],
|
|
"summary": "Delete a message",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "conversation_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Message ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "No Content",
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/{id}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves detailed information about a specific conversation within an account",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Conversations"
|
|
],
|
|
"summary": "Get a single conversation",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Conversation"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/{id}/assign": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Assigns a specific agent to a conversation by providing the assignee ID",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Conversations"
|
|
],
|
|
"summary": "Assign an agent to a conversation",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Agent assignment payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.AssignAgentRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Conversation"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/{id}/assignments": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Assigns a team (and optionally an agent) to a conversation",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Conversations"
|
|
],
|
|
"summary": "Assign a team to a conversation",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Team assignment payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Conversation"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/{id}/mute": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Mutes a conversation to suppress notifications",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Conversations"
|
|
],
|
|
"summary": "Mute a conversation",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Conversation"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/{id}/toggle_status": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Toggles the status of a conversation between open, pending, resolved, or snoozed",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Conversations"
|
|
],
|
|
"summary": "Toggle conversation status",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Status toggle payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.ToggleStatusRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Conversation"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/conversations/{id}/unmute": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Unmutes a conversation to restore notifications",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Conversations"
|
|
],
|
|
"summary": "Unmute a conversation",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Conversation ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Conversation"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/search": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Searches across conversations, messages, contacts, and articles with advanced filtering and pagination",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Search"
|
|
],
|
|
"summary": "Global search across all entity types",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Search query string",
|
|
"name": "q",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "conversation,message,contact,article",
|
|
"description": "Entity types to search (conversation,message,contact,article)",
|
|
"name": "types",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "ilike",
|
|
"description": "Search mode: ilike (substring) or trigram (fuzzy)",
|
|
"name": "search_mode",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Conversation status filter (open,resolved,pending,snoozed)",
|
|
"name": "status",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Conversation priority filter (none,low,medium,high,urgent)",
|
|
"name": "priority",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Assignee agent ID filter",
|
|
"name": "assignee_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Team ID filter",
|
|
"name": "team_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Inbox ID filter",
|
|
"name": "inbox_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Label filter (comma-separated)",
|
|
"name": "labels",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Contact source filter (email,phone,website,api)",
|
|
"name": "contact_source",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Message type filter (incoming,outgoing,activity)",
|
|
"name": "message_type",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Sender type filter",
|
|
"name": "sender_type",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Content type filter (text,input_email,card)",
|
|
"name": "content_type",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "boolean",
|
|
"description": "Private message filter",
|
|
"name": "private",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Date range start (ISO 8601)",
|
|
"name": "date_from",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Date range end (ISO 8601)",
|
|
"name": "date_to",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Portal ID filter (for article search)",
|
|
"name": "portal_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Article status filter (draft,published,archived)",
|
|
"name": "article_status",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Article locale filter",
|
|
"name": "article_locale",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "created_at",
|
|
"description": "Sort field (created_at,last_activity_at,updated_at)",
|
|
"name": "sort_by",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "desc",
|
|
"description": "Sort order (asc,desc)",
|
|
"name": "sort_order",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "per_page",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/search.SearchResponse"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/search/articles": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Searches knowledge base articles by query string (title, description, content) with portal, status, and locale filters",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Search"
|
|
],
|
|
"summary": "Search knowledge base articles",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Search query string",
|
|
"name": "q",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "ilike",
|
|
"description": "Search mode: ilike (substring) or trigram (fuzzy)",
|
|
"name": "search_mode",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Portal ID filter",
|
|
"name": "portal_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Article status filter (draft,published,archived)",
|
|
"name": "article_status",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Article locale filter (en,es,fr,de,pt,etc)",
|
|
"name": "article_locale",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Author ID filter",
|
|
"name": "author_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "created_at",
|
|
"description": "Sort field (created_at,updated_at)",
|
|
"name": "sort_by",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "desc",
|
|
"description": "Sort order (asc,desc)",
|
|
"name": "sort_order",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "per_page",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/search/contacts": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Searches contacts by query string (name, email, phone, identifier) with advanced filtering",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Search"
|
|
],
|
|
"summary": "Search contacts",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Search query string",
|
|
"name": "q",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "ilike",
|
|
"description": "Search mode: ilike (substring) or trigram (fuzzy)",
|
|
"name": "search_mode",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Contact source filter (email,phone,website,api)",
|
|
"name": "contact_source",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "created_at",
|
|
"description": "Sort field (created_at,updated_at,name)",
|
|
"name": "sort_by",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "desc",
|
|
"description": "Sort order (asc,desc)",
|
|
"name": "sort_order",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "per_page",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/search/conversations": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Searches conversations by query string with advanced filtering (status, assignee, labels, date range)",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Search"
|
|
],
|
|
"summary": "Search conversations",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Search query string",
|
|
"name": "q",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "ilike",
|
|
"description": "Search mode: ilike (substring) or trigram (fuzzy)",
|
|
"name": "search_mode",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Conversation status filter (open,resolved,pending,snoozed)",
|
|
"name": "status",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Conversation priority filter (none,low,medium,high,urgent)",
|
|
"name": "priority",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Assignee agent ID filter",
|
|
"name": "assignee_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Team ID filter",
|
|
"name": "team_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Inbox ID filter",
|
|
"name": "inbox_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Label filter (comma-separated)",
|
|
"name": "labels",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Date range start (ISO 8601)",
|
|
"name": "date_from",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Date range end (ISO 8601)",
|
|
"name": "date_to",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "created_at",
|
|
"description": "Sort field (created_at,last_activity_at,updated_at)",
|
|
"name": "sort_by",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "desc",
|
|
"description": "Sort order (asc,desc)",
|
|
"name": "sort_order",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "per_page",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{account_id}/search/messages": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Searches messages by query string with advanced filtering (message type, sender type, content type, private)",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Search"
|
|
],
|
|
"summary": "Search messages",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "account_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Search query string",
|
|
"name": "q",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "ilike",
|
|
"description": "Search mode: ilike (substring) or trigram (fuzzy)",
|
|
"name": "search_mode",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Message type filter (incoming,outgoing,activity)",
|
|
"name": "message_type",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Sender type filter",
|
|
"name": "sender_type",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Content type filter (text,input_email,card)",
|
|
"name": "content_type",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "boolean",
|
|
"description": "Private message filter",
|
|
"name": "private",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Inbox ID filter",
|
|
"name": "inbox_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Date range start (ISO 8601)",
|
|
"name": "date_from",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Date range end (ISO 8601)",
|
|
"name": "date_to",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "created_at",
|
|
"description": "Sort field (created_at,updated_at)",
|
|
"name": "sort_by",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "desc",
|
|
"description": "Sort order (asc,desc)",
|
|
"name": "sort_order",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "per_page",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{id}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves detailed information about a specific account",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Accounts"
|
|
],
|
|
"summary": "Get a single account by ID",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Account"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Modifies account details such as name and settings",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Accounts"
|
|
],
|
|
"summary": "Update an existing account",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Account update payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.UpdateAccountRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Account"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Soft-deletes an account by ID",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Accounts"
|
|
],
|
|
"summary": "Delete an account",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "No Content"
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{id}/contacts": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves all contacts for an account with pagination and optional sort",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Contacts"
|
|
],
|
|
"summary": "List contacts for an account",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "name",
|
|
"description": "Sort field",
|
|
"name": "sort",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Contact"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Creates a new contact, optionally auto-creating a ContactInbox when inbox_id is provided",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Contacts"
|
|
],
|
|
"summary": "Create a new contact",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Contact creation payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.CreateContactRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Contact"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{id}/contacts/search": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Searches contacts by query string with pagination, sort, and search mode support",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Contacts"
|
|
],
|
|
"summary": "Search contacts",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Search query",
|
|
"name": "q",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Sort field",
|
|
"name": "sort",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"default": "prefix",
|
|
"description": "Search mode (prefix/semantic/fulltext)",
|
|
"name": "search_mode",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Contact"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{id}/contacts/{contact_id}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves detailed information about a specific contact within an account",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Contacts"
|
|
],
|
|
"summary": "Get a single contact",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Contact ID",
|
|
"name": "contact_id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Contact"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Modifies an existing contact's details",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Contacts"
|
|
],
|
|
"summary": "Update a contact",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Contact ID",
|
|
"name": "contact_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Contact update payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.UpdateContactRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Contact"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Soft-deletes a contact from an account",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Contacts"
|
|
],
|
|
"summary": "Delete a contact",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Contact ID",
|
|
"name": "contact_id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{id}/inboxes": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves all inboxes for an account with pagination",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Inboxes"
|
|
],
|
|
"summary": "List inboxes for an account",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 25,
|
|
"description": "Items per page",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Inbox"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Creates a new inbox for an account",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Inboxes"
|
|
],
|
|
"summary": "Create a new inbox",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Inbox creation payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.CreateInboxRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Inbox"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/accounts/{id}/inboxes/{inbox_id}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieves detailed information about a specific inbox within an account",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Inboxes"
|
|
],
|
|
"summary": "Get a single inbox",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Inbox ID",
|
|
"name": "inbox_id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Inbox"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Updates an existing inbox's configuration",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Inboxes"
|
|
],
|
|
"summary": "Update an inbox",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Inbox ID",
|
|
"name": "inbox_id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Inbox update payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/service.UpdateInboxRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Inbox"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"security": [
|
|
{
|
|
"ApiKeyAuth": []
|
|
}
|
|
],
|
|
"description": "Deletes an inbox from an account",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Inboxes"
|
|
],
|
|
"summary": "Delete an inbox",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Account ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Inbox ID",
|
|
"name": "inbox_id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"gorm.DeletedAt": {
|
|
"type": "object",
|
|
"properties": {
|
|
"time": {
|
|
"type": "string"
|
|
},
|
|
"valid": {
|
|
"description": "Valid is true if Time is not NULL",
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"model.Account": {
|
|
"type": "object",
|
|
"properties": {
|
|
"active": {
|
|
"type": "boolean"
|
|
},
|
|
"auto_resolve_duration": {
|
|
"description": "days",
|
|
"type": "integer"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"deleted_at": {
|
|
"$ref": "#/definitions/gorm.DeletedAt"
|
|
},
|
|
"domain": {
|
|
"type": "string"
|
|
},
|
|
"feature_flags": {
|
|
"description": "JSON-encoded feature flags",
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"locale": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"type": "string"
|
|
},
|
|
"timezone": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"model.Contact": {
|
|
"type": "object",
|
|
"properties": {
|
|
"account_id": {
|
|
"type": "integer"
|
|
},
|
|
"additional_attributes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"avatar_url": {
|
|
"type": "string"
|
|
},
|
|
"blocked": {
|
|
"type": "boolean"
|
|
},
|
|
"company_id": {
|
|
"type": "integer"
|
|
},
|
|
"contact_type": {
|
|
"type": "string"
|
|
},
|
|
"country_code": {
|
|
"type": "string"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"custom_attributes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"deleted_at": {
|
|
"$ref": "#/definitions/gorm.DeletedAt"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"identifier": {
|
|
"type": "string"
|
|
},
|
|
"last_activity_at": {
|
|
"type": "integer"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"location": {
|
|
"type": "string"
|
|
},
|
|
"middle_name": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"phone_number": {
|
|
"type": "string"
|
|
},
|
|
"source_id": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"model.Conversation": {
|
|
"type": "object",
|
|
"properties": {
|
|
"account_id": {
|
|
"type": "integer"
|
|
},
|
|
"additional_attributes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"agent_last_seen_at": {
|
|
"type": "integer"
|
|
},
|
|
"assignee_id": {
|
|
"type": "integer"
|
|
},
|
|
"assignee_last_seen_at": {
|
|
"type": "integer"
|
|
},
|
|
"campaign_id": {
|
|
"type": "integer"
|
|
},
|
|
"channel": {
|
|
"description": "channel identifier for routing",
|
|
"type": "string"
|
|
},
|
|
"channel_type": {
|
|
"type": "string"
|
|
},
|
|
"contact_id": {
|
|
"type": "integer"
|
|
},
|
|
"contact_inbox_id": {
|
|
"type": "integer"
|
|
},
|
|
"contact_last_seen_at": {
|
|
"type": "integer"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"custom_attributes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"deleted_at": {
|
|
"$ref": "#/definitions/gorm.DeletedAt"
|
|
},
|
|
"display_id": {
|
|
"description": "account-level auto-increment number",
|
|
"type": "integer"
|
|
},
|
|
"first_reply_created_at": {
|
|
"type": "integer"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"inbox_id": {
|
|
"type": "integer"
|
|
},
|
|
"labels": {
|
|
"description": "comma-separated or JSON label list",
|
|
"type": "string"
|
|
},
|
|
"last_activity_at": {
|
|
"type": "integer"
|
|
},
|
|
"last_message_at": {
|
|
"type": "integer"
|
|
},
|
|
"last_non_system_message_at": {
|
|
"type": "integer"
|
|
},
|
|
"muted": {
|
|
"type": "boolean"
|
|
},
|
|
"priority": {
|
|
"description": "none, low, medium, high, urgent",
|
|
"type": "string"
|
|
},
|
|
"resolved_at": {
|
|
"description": "Chatwoot: timestamp when conversation was resolved",
|
|
"type": "string"
|
|
},
|
|
"resumed_at": {
|
|
"description": "Chatwoot: timestamp when conversation was reopened",
|
|
"type": "string"
|
|
},
|
|
"sla_policy_id": {
|
|
"type": "integer"
|
|
},
|
|
"snoozed_until": {
|
|
"description": "timestamp for snoozed conversations",
|
|
"type": "integer"
|
|
},
|
|
"status": {
|
|
"description": "open, resolved, pending, snoozed",
|
|
"type": "string"
|
|
},
|
|
"team_id": {
|
|
"type": "integer"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"uuid": {
|
|
"description": "auto-generated global unique identifier",
|
|
"type": "string"
|
|
},
|
|
"waiting_since": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"model.ErrorResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"error": {
|
|
"type": "string",
|
|
"example": "not_found"
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"example": "Resource not found"
|
|
}
|
|
}
|
|
},
|
|
"model.Inbox": {
|
|
"type": "object",
|
|
"properties": {
|
|
"account_id": {
|
|
"type": "integer"
|
|
},
|
|
"allow_messages_after_resolved": {
|
|
"type": "boolean"
|
|
},
|
|
"auto_assignment_limit": {
|
|
"type": "integer"
|
|
},
|
|
"avatar_url": {
|
|
"description": "URL to inbox avatar image",
|
|
"type": "string"
|
|
},
|
|
"business_name": {
|
|
"type": "string"
|
|
},
|
|
"channel_config": {
|
|
"description": "JSON-encoded per-inbox channel configuration",
|
|
"type": "string"
|
|
},
|
|
"channel_id": {
|
|
"type": "integer"
|
|
},
|
|
"channel_type": {
|
|
"description": "web_widget, facebook, twitter, whatsapp, telegram, email, api, etc",
|
|
"type": "string"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"csat_config": {
|
|
"description": "JSON-encoded CSAT survey configuration",
|
|
"type": "string"
|
|
},
|
|
"csat_survey_enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"deleted_at": {
|
|
"$ref": "#/definitions/gorm.DeletedAt"
|
|
},
|
|
"enable_auto_assignment": {
|
|
"type": "boolean"
|
|
},
|
|
"enable_email_collect": {
|
|
"type": "boolean"
|
|
},
|
|
"enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"greeting_enabled": {
|
|
"description": "Chatwoot inbox settings (from permitted_params)",
|
|
"type": "boolean"
|
|
},
|
|
"greeting_message": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"lock_to_single_conversation": {
|
|
"type": "boolean"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"out_of_office_message": {
|
|
"type": "string"
|
|
},
|
|
"portal_id": {
|
|
"description": "FK to help-center portal (nullable)",
|
|
"type": "integer"
|
|
},
|
|
"secret": {
|
|
"description": "HMAC secret for API inbox webhook verification",
|
|
"type": "string"
|
|
},
|
|
"sender_name_type": {
|
|
"description": "friendly_name, business_name, random",
|
|
"type": "string"
|
|
},
|
|
"timezone": {
|
|
"description": "e.g. \"Asia/Kolkata\"",
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"webhook_url": {
|
|
"description": "API inbox specific fields",
|
|
"type": "string"
|
|
},
|
|
"working_hours_enabled": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"model.JSONMap": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
},
|
|
"model.Message": {
|
|
"type": "object",
|
|
"properties": {
|
|
"account_id": {
|
|
"type": "integer"
|
|
},
|
|
"additional_attributes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"content": {
|
|
"type": "string"
|
|
},
|
|
"content_attributes": {
|
|
"description": "attachments, mentions, etc",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"content_type": {
|
|
"description": "text, input, input_csat, file, image, etc",
|
|
"type": "string"
|
|
},
|
|
"conversation_id": {
|
|
"type": "integer"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"deleted_at": {
|
|
"$ref": "#/definitions/gorm.DeletedAt"
|
|
},
|
|
"external": {
|
|
"type": "boolean"
|
|
},
|
|
"external_source_ids": {
|
|
"description": "external platform IDs",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"inbox_id": {
|
|
"type": "integer"
|
|
},
|
|
"message_type": {
|
|
"description": "incoming, outgoing, activity, template",
|
|
"type": "string"
|
|
},
|
|
"private": {
|
|
"type": "boolean"
|
|
},
|
|
"sender_id": {
|
|
"type": "integer"
|
|
},
|
|
"sender_type": {
|
|
"description": "contact, agent, bot",
|
|
"type": "string"
|
|
},
|
|
"source_id": {
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"description": "sent, delivered, read, failed",
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"search.SearchResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"by_type": {
|
|
"description": "count per type: {\"conversation\":5,\"message\":12,...}",
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
}
|
|
},
|
|
"page": {
|
|
"type": "integer"
|
|
},
|
|
"per_page": {
|
|
"type": "integer"
|
|
},
|
|
"query": {
|
|
"type": "string"
|
|
},
|
|
"results": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/search.SearchResult"
|
|
}
|
|
},
|
|
"total_count": {
|
|
"description": "total hits across all types",
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"search.SearchResult": {
|
|
"type": "object",
|
|
"properties": {
|
|
"account_id": {
|
|
"type": "integer"
|
|
},
|
|
"data": {
|
|
"description": "full entity payload (Conversation, Message, Contact)"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"score": {
|
|
"description": "relevance score (higher = more relevant)",
|
|
"type": "number"
|
|
},
|
|
"snippet": {
|
|
"description": "short excerpt for display",
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"$ref": "#/definitions/search.SearchResultType"
|
|
}
|
|
}
|
|
},
|
|
"search.SearchResultType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"conversation",
|
|
"message",
|
|
"contact",
|
|
"article"
|
|
],
|
|
"x-enum-varnames": [
|
|
"ResultTypeConversation",
|
|
"ResultTypeMessage",
|
|
"ResultTypeContact",
|
|
"ResultTypeArticle"
|
|
]
|
|
},
|
|
"service.AssignAgentRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"assignee_id"
|
|
],
|
|
"properties": {
|
|
"assignee_id": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"service.CreateAccountRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"name"
|
|
],
|
|
"properties": {
|
|
"domain": {
|
|
"type": "string",
|
|
"minLength": 3
|
|
},
|
|
"locale": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 2
|
|
}
|
|
}
|
|
},
|
|
"service.CreateContactRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"name"
|
|
],
|
|
"properties": {
|
|
"additional_attributes": {
|
|
"$ref": "#/definitions/model.JSONMap"
|
|
},
|
|
"avatar_url": {
|
|
"type": "string"
|
|
},
|
|
"company_id": {
|
|
"type": "integer"
|
|
},
|
|
"contact_type": {
|
|
"type": "string"
|
|
},
|
|
"country_code": {
|
|
"type": "string"
|
|
},
|
|
"custom_attributes": {
|
|
"$ref": "#/definitions/model.JSONMap"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"identifier": {
|
|
"type": "string"
|
|
},
|
|
"inbox_id": {
|
|
"type": "integer"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"location": {
|
|
"type": "string"
|
|
},
|
|
"middle_name": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"phone": {
|
|
"type": "string"
|
|
},
|
|
"source_id": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"service.CreateInboxRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"channel_type",
|
|
"name"
|
|
],
|
|
"properties": {
|
|
"channel_type": {
|
|
"type": "string",
|
|
"enum": [
|
|
"web_widget",
|
|
"telegram",
|
|
"facebook",
|
|
"instagram",
|
|
"whatsapp",
|
|
"email",
|
|
"api",
|
|
"tiktok",
|
|
"line",
|
|
"twilio_sms"
|
|
]
|
|
},
|
|
"enable_auto_assignment": {
|
|
"type": "boolean"
|
|
},
|
|
"enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 2
|
|
}
|
|
}
|
|
},
|
|
"service.CreateMessageRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"content",
|
|
"conversation_id",
|
|
"message_type"
|
|
],
|
|
"properties": {
|
|
"content": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"content_type": {
|
|
"type": "string",
|
|
"enum": [
|
|
"text",
|
|
"input_text",
|
|
"input_email",
|
|
"input_phone",
|
|
"select",
|
|
"card",
|
|
"private_note"
|
|
]
|
|
},
|
|
"conversation_id": {
|
|
"type": "integer"
|
|
},
|
|
"message_type": {
|
|
"type": "string",
|
|
"enum": [
|
|
"outgoing",
|
|
"incoming",
|
|
"activity",
|
|
"template",
|
|
"private_note"
|
|
]
|
|
},
|
|
"private": {
|
|
"type": "boolean"
|
|
},
|
|
"source_id": {
|
|
"description": "Chatwoot: source_id for message origin (user/agent/bot)",
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"service.ToggleStatusRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"status"
|
|
],
|
|
"properties": {
|
|
"assignee_id": {
|
|
"description": "Chatwoot: auto-assign on reopen",
|
|
"type": "integer"
|
|
},
|
|
"is_bot": {
|
|
"description": "Chatwoot: pending_to_open_by_bot — agent bot triggers handoff",
|
|
"type": "boolean"
|
|
},
|
|
"snoozed_until": {
|
|
"description": "Chatwoot: snooze with wake-up time (unix timestamp)",
|
|
"type": "integer"
|
|
},
|
|
"status": {
|
|
"type": "string",
|
|
"enum": [
|
|
"open",
|
|
"resolved",
|
|
"pending",
|
|
"snoozed"
|
|
]
|
|
},
|
|
"user_id": {
|
|
"description": "Chatwoot: should_assign_conversation — auto-assign to agent who opens",
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"service.UpdateAccountRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"auto_resolve_duration": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"domain": {
|
|
"type": "string",
|
|
"minLength": 3
|
|
},
|
|
"feature_flags": {
|
|
"type": "string"
|
|
},
|
|
"locale": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 2
|
|
},
|
|
"status": {
|
|
"type": "string",
|
|
"enum": [
|
|
"active",
|
|
"inactive"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"service.UpdateContactRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"additional_attributes": {
|
|
"$ref": "#/definitions/model.JSONMap"
|
|
},
|
|
"avatar_url": {
|
|
"type": "string"
|
|
},
|
|
"company_id": {
|
|
"type": "integer"
|
|
},
|
|
"contact_type": {
|
|
"type": "string"
|
|
},
|
|
"country_code": {
|
|
"type": "string"
|
|
},
|
|
"custom_attributes": {
|
|
"$ref": "#/definitions/model.JSONMap"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"identifier": {
|
|
"type": "string"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"location": {
|
|
"type": "string"
|
|
},
|
|
"middle_name": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"phone": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"service.UpdateInboxRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"enable_auto_assignment": {
|
|
"type": "boolean"
|
|
},
|
|
"enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}`
|
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
var SwaggerInfo = &swag.Spec{
|
|
Version: "",
|
|
Host: "",
|
|
BasePath: "",
|
|
Schemes: []string{},
|
|
Title: "",
|
|
Description: "",
|
|
InfoInstanceName: "swagger",
|
|
SwaggerTemplate: docTemplate,
|
|
LeftDelim: "{{",
|
|
RightDelim: "}}",
|
|
}
|
|
|
|
func init() {
|
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
|
}
|