Blazor Diffusion

<back to all web services

GetAnalyticsReports

import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RequestSummary:
    name: Optional[str] = None
    total_requests: int = 0
    total_request_length: int = 0
    min_request_length: int = 0
    max_request_length: int = 0
    total_duration: float = 0.0
    min_duration: float = 0.0
    max_duration: float = 0.0
    status: Optional[Dict[int, int]] = None
    durations: Optional[Dict[str, int]] = None
    apis: Optional[Dict[str, int]] = None
    users: Optional[Dict[str, int]] = None
    ips: Optional[Dict[str, int]] = None
    api_keys: Optional[Dict[str, int]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AnalyticsReports:
    id: int = 0
    created: datetime.datetime = datetime.datetime(1, 1, 1)
    version: Decimal = decimal.Decimal(0)
    apis: Optional[Dict[str, RequestSummary]] = None
    users: Optional[Dict[str, RequestSummary]] = None
    tags: Optional[Dict[str, RequestSummary]] = None
    status: Optional[Dict[str, RequestSummary]] = None
    days: Optional[Dict[str, RequestSummary]] = None
    api_keys: Optional[Dict[str, RequestSummary]] = None
    ips: Optional[Dict[str, RequestSummary]] = None
    browsers: Optional[Dict[str, RequestSummary]] = None
    devices: Optional[Dict[str, RequestSummary]] = None
    bots: Optional[Dict[str, RequestSummary]] = None
    durations: Optional[Dict[str, int]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetAnalyticsReportsResponse:
    result: Optional[AnalyticsReports] = None
    response_status: Optional[ResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetAnalyticsReports(IGet):
    month: Optional[datetime.datetime] = None
    filter: Optional[str] = None
    value: Optional[str] = None
    force: Optional[bool] = None

Python GetAnalyticsReports DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsv/reply/GetAnalyticsReports HTTP/1.1 
Host: blazordiffusion.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	month: 0001-01-01,
	filter: String,
	value: String,
	force: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	result: 
	{
		id: 0,
		created: 0001-01-01,
		version: 0,
		apis: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		users: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		tags: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		status: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		days: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		apiKeys: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		ips: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		browsers: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		devices: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		bots: 
		{
			String: 
			{
				name: String,
				totalRequests: 0,
				totalRequestLength: 0,
				minRequestLength: 0,
				maxRequestLength: 0,
				totalDuration: 0,
				minDuration: 0,
				maxDuration: 0,
				status: 
				{
					0: 0
				},
				durations: 
				{
					String: 0
				},
				apis: 
				{
					String: 0
				},
				users: 
				{
					String: 0
				},
				ips: 
				{
					String: 0
				},
				apiKeys: 
				{
					String: 0
				}
			}
		},
		durations: 
		{
			String: 0
		}
	},
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}