swagerr doc

This commit is contained in:
2025-03-26 17:39:58 +08:00
parent 913c9cd289
commit ca8a7d56f1
2 changed files with 274 additions and 20 deletions

View File

@@ -175,7 +175,9 @@ export default function SwaggerPage() {
},
'/events/time-series': {
get: {
tags: ['events'],
summary: 'Get time series data',
description: 'Get time-based analytics data for events',
parameters: [
{
name: 'startTime',
@@ -185,6 +187,7 @@ export default function SwaggerPage() {
type: 'string',
format: 'date-time',
},
description: 'Start time for time series data (ISO 8601 format)',
},
{
name: 'endTime',
@@ -194,6 +197,7 @@ export default function SwaggerPage() {
type: 'string',
format: 'date-time',
},
description: 'End time for time series data (ISO 8601 format)',
},
],
responses: {
@@ -215,12 +219,24 @@ export default function SwaggerPage() {
},
},
},
'400': {
description: 'Bad request',
content: {
'application/json': {
schema: {
$ref: '#/components/schemas/Error',
},
},
},
},
},
},
},
'/events/geo': {
get: {
tags: ['events'],
summary: 'Get geographic data',
description: 'Get geographic distribution of events',
parameters: [
{
name: 'startTime',
@@ -230,6 +246,7 @@ export default function SwaggerPage() {
type: 'string',
format: 'date-time',
},
description: 'Start time for geographic data (ISO 8601 format)',
},
{
name: 'endTime',
@@ -239,6 +256,7 @@ export default function SwaggerPage() {
type: 'string',
format: 'date-time',
},
description: 'End time for geographic data (ISO 8601 format)',
},
],
responses: {
@@ -260,12 +278,24 @@ export default function SwaggerPage() {
},
},
},
'400': {
description: 'Bad request',
content: {
'application/json': {
schema: {
$ref: '#/components/schemas/Error',
},
},
},
},
},
},
},
'/events/devices': {
get: {
tags: ['events'],
summary: 'Get device analytics data',
description: 'Get device-related analytics for events',
parameters: [
{
name: 'startTime',
@@ -275,6 +305,7 @@ export default function SwaggerPage() {
type: 'string',
format: 'date-time',
},
description: 'Start time for device analytics (ISO 8601 format)',
},
{
name: 'endTime',
@@ -284,6 +315,7 @@ export default function SwaggerPage() {
type: 'string',
format: 'date-time',
},
description: 'End time for device analytics (ISO 8601 format)',
},
],
responses: {
@@ -302,6 +334,16 @@ export default function SwaggerPage() {
},
},
},
'400': {
description: 'Bad request',
content: {
'application/json': {
schema: {
$ref: '#/components/schemas/Error',
},
},
},
},
},
},
},
@@ -408,22 +450,56 @@ export default function SwaggerPage() {
TimeSeriesData: {
type: 'object',
properties: {
timestamp: { type: 'string', format: 'date-time' },
events: { type: 'number' },
visitors: { type: 'number' },
conversions: { type: 'number' },
timestamp: {
type: 'string',
format: 'date-time',
description: 'Time point in the series',
},
events: {
type: 'number',
description: 'Number of events at this time point',
},
visitors: {
type: 'number',
description: 'Number of unique visitors at this time point',
},
conversions: {
type: 'number',
description: 'Number of conversions at this time point',
},
},
},
GeoData: {
type: 'object',
properties: {
location: { type: 'string' },
country: { type: 'string' },
region: { type: 'string' },
city: { type: 'string' },
visits: { type: 'number' },
visitors: { type: 'number' },
percentage: { type: 'number' },
location: {
type: 'string',
description: 'Location identifier',
},
country: {
type: 'string',
description: 'Country name',
},
region: {
type: 'string',
description: 'Region/state name',
},
city: {
type: 'string',
description: 'City name',
},
visits: {
type: 'number',
description: 'Number of visits from this location',
},
visitors: {
type: 'number',
description: 'Number of unique visitors from this location',
},
percentage: {
type: 'number',
description: 'Percentage of total visits',
},
},
},
DeviceAnalytics: {
@@ -434,9 +510,18 @@ export default function SwaggerPage() {
items: {
type: 'object',
properties: {
type: { type: 'string' },
count: { type: 'number' },
percentage: { type: 'number' },
type: {
type: 'string',
description: 'Device type',
},
count: {
type: 'number',
description: 'Number of visits from this device type',
},
percentage: {
type: 'number',
description: 'Percentage of total visits',
},
},
},
},
@@ -445,9 +530,18 @@ export default function SwaggerPage() {
items: {
type: 'object',
properties: {
name: { type: 'string' },
count: { type: 'number' },
percentage: { type: 'number' },
name: {
type: 'string',
description: 'Browser name',
},
count: {
type: 'number',
description: 'Number of visits from this browser',
},
percentage: {
type: 'number',
description: 'Percentage of total visits',
},
},
},
},
@@ -456,9 +550,18 @@ export default function SwaggerPage() {
items: {
type: 'object',
properties: {
name: { type: 'string' },
count: { type: 'number' },
percentage: { type: 'number' },
name: {
type: 'string',
description: 'Operating system name',
},
count: {
type: 'number',
description: 'Number of visits from this OS',
},
percentage: {
type: 'number',
description: 'Percentage of total visits',
},
},
},
},