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
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: test-do-services.klokgroep.nl
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
}
}
}