| GET | /DashboardStats |
|---|
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 PagingMetadata:
# @ApiMember(DataType="string", Description="Starting Record", Name="Offset", ParameterType="query")
offset: Optional[str] = None
"""
Starting Record
"""
# @ApiMember(DataType="string", Description="Number of records to return (PageSize)", Name="Limit", ParameterType="query")
limit: Optional[str] = None
"""
Number of records to return (PageSize)
"""
# @ApiMember(DataType="string", Description="Total Number of Records in a Full Reponse (if no paging)", Name="TotalRecords", ParameterType="query")
total_records: int = 0
"""
Total Number of Records in a Full Reponse (if no paging)
"""
# @ApiMember(DataType="string", Description="Total Number of Records in this Reponse (on this page)", Name="ResponseRecords", ParameterType="query")
response_records: int = 0
"""
Total Number of Records in this Reponse (on this page)
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ThreeDayCounts:
day_plus_zero_ttl: int = 0
day_plus_one_ttl: int = 0
day_plus_two_ttl: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MonthlyActivityBreakdown:
report_date: Optional[str] = None
monthly_events: int = 0
c: int = 0
c__percentage: float = 0.0
i: int = 0
i__percentage: float = 0.0
t: int = 0
t__percentage: float = 0.0
x: int = 0
x__percentage: float = 0.0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UserActivity:
user_name: Optional[str] = None
first_name: Optional[str] = None
last_name: Optional[str] = None
user_i_d: int = 0
user_frequency: Optional[str] = None
activity_measure: float = 0.0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ConsultantPerformance:
name: Optional[str] = None
total: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ReportPerformance:
name: Optional[str] = None
url_slug: Optional[str] = None
total: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BookingsAirConversion:
total_ticketed: int = 0
total_unticketed: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PassengerContactElements:
date_year: int = 0
date_month: int = 0
with_mobile_percent: float = 0.0
with_email_percent: float = 0.0
total_with_mobile: int = 0
total_with_email: int = 0
total_created: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DashboardStats:
problematic_bookings: Optional[ThreeDayCounts] = None
airline_ticketing: Optional[ThreeDayCounts] = None
unticketed_bookings_by_tau: Optional[ThreeDayCounts] = None
outstanding_booking_actions: Optional[ThreeDayCounts] = None
monthly_activity: Optional[List[MonthlyActivityBreakdown]] = None
most_active_users: Optional[List[UserActivity]] = None
top_consultants: Optional[List[ConsultantPerformance]] = None
top_reports: Optional[List[ReportPerformance]] = None
active_bookings_air_conversion: Optional[BookingsAirConversion] = None
passenger_elements: Optional[List[PassengerContactElements]] = None
report_usage_summary: Optional[List[ReportPerformance]] = None
monthly_activity_formatted: Optional[str] = None
passenger_elements_formatted: Optional[str] = None
TItemResponse = TypeVar('TItemResponse')
TItem = TypeVar('TItem')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Report(Generic[TItemResponse, TItem]):
item: Optional[TItem] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DashboardStatsByOptionsResponseReport(Report[DashboardStatsByOptionsItemResponse, DashboardStats]):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CacheMetadata:
cached_at: datetime.datetime = datetime.datetime(1, 1, 1)
cache_expires_at: datetime.datetime = datetime.datetime(1, 1, 1)
is_from_cache: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ResponseMetadata:
success: bool = False
has_cache: bool = False
has_paging: bool = False
cache_metadata: Optional[CacheMetadata] = None
paging_metadata: Optional[PagingMetadata] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AgentivityError:
error_code: Optional[str] = None
message: Optional[str] = None
status_code: Optional[str] = None
verbose_message: Optional[str] = None
TItem = TypeVar('TItem')
TReport = TypeVar('TReport')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ItemResponse(Generic[TItem, TReport]):
response_metadata: Optional[ResponseMetadata] = None
response_report: Optional[TReport] = None
response_error: Optional[AgentivityError] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DashboardStatsByOptionsItemResponse(ItemResponse[DashboardStats, DashboardStatsByOptionsResponseReport]):
pass
# @Flags()
class DashboardOptions(IntEnum):
PROBLEMATIC_BOOKINGS_COUNT = 1
AIRLINE_TICKETING_COUNT = 2
UNTICKETED_BOOKINGS_BY_TAU_COUNT = 4
MONTHLY_ACTIVITY = 8
ACTIVE_BOOKINGS_AIR_CONVERSION = 16
PASSENGER_CONTACTS = 32
TOP_CONSULTANTS = 64
MOST_ACTIVE_USERS = 128
TOP_REPORTS = 256
REPORT_USAGE_SUMMARY = 512
OUTSTANDING_BOOKING_ACTIONS_COUNT = 1024
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DashboardStatsByOptions(PagingMetadata):
user_name: Optional[str] = None
"""
UserName in form of an email address
"""
reports_top: Optional[int] = None
"""
Top reports
"""
reports_days_span: Optional[int] = None
"""
Reports in days span
"""
most_active_users_top: Optional[int] = None
"""
Top most active users
"""
most_active_users_days_span: Optional[int] = None
"""
Most active users in days span
"""
top_consultants_last_days_span: Optional[int] = None
"""
Top consultants last days span
"""
options: Optional[DashboardOptions] = None
"""
Options
"""
Python DashboardStatsByOptions DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /DashboardStats HTTP/1.1 Host: servicestack.agentivity.com Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<AgentivityResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="schemas.agentivity.com/types">
<ResponseMetadata>
<Success>false</Success>
<HasCache>false</HasCache>
<HasPaging>false</HasPaging>
<CacheMetadata>
<IsFromCache>false</IsFromCache>
<CachedAt>0001-01-01T00:00:00</CachedAt>
<CacheExpiresAt>0001-01-01T00:00:00</CacheExpiresAt>
</CacheMetadata>
<PagingMetadata>
<Limit>String</Limit>
<Offset>String</Offset>
<ResponseRecords>0</ResponseRecords>
<TotalRecords>0</TotalRecords>
</PagingMetadata>
</ResponseMetadata>
<ResponseReport>
<Item>
<ProblematicBookings>
<DayPlusZeroTtl>0</DayPlusZeroTtl>
<DayPlusOneTtl>0</DayPlusOneTtl>
<DayPlusTwoTtl>0</DayPlusTwoTtl>
</ProblematicBookings>
<AirlineTicketing>
<DayPlusZeroTtl>0</DayPlusZeroTtl>
<DayPlusOneTtl>0</DayPlusOneTtl>
<DayPlusTwoTtl>0</DayPlusTwoTtl>
</AirlineTicketing>
<UnticketedBookingsByTau>
<DayPlusZeroTtl>0</DayPlusZeroTtl>
<DayPlusOneTtl>0</DayPlusOneTtl>
<DayPlusTwoTtl>0</DayPlusTwoTtl>
</UnticketedBookingsByTau>
<OutstandingBookingActions>
<DayPlusZeroTtl>0</DayPlusZeroTtl>
<DayPlusOneTtl>0</DayPlusOneTtl>
<DayPlusTwoTtl>0</DayPlusTwoTtl>
</OutstandingBookingActions>
<MonthlyActivity>
<MonthlyActivityBreakdown>
<ReportDate>String</ReportDate>
<MonthlyEvents>0</MonthlyEvents>
<C>0</C>
<C_Percentage>0</C_Percentage>
<I>0</I>
<I_Percentage>0</I_Percentage>
<T>0</T>
<T_Percentage>0</T_Percentage>
<X>0</X>
<X_Percentage>0</X_Percentage>
</MonthlyActivityBreakdown>
</MonthlyActivity>
<MostActiveUsers>
<UserActivity>
<UserName>String</UserName>
<FirstName>String</FirstName>
<LastName>String</LastName>
<UserID>0</UserID>
<UserFrequency>String</UserFrequency>
<ActivityMeasure>0</ActivityMeasure>
</UserActivity>
</MostActiveUsers>
<TopConsultants>
<ConsultantPerformance>
<Name>String</Name>
<Total>0</Total>
</ConsultantPerformance>
</TopConsultants>
<TopReports>
<ReportPerformance>
<Name>String</Name>
<UrlSlug>String</UrlSlug>
<Total>0</Total>
</ReportPerformance>
</TopReports>
<ActiveBookingsAirConversion>
<TotalTicketed>0</TotalTicketed>
<TotalUnticketed>0</TotalUnticketed>
</ActiveBookingsAirConversion>
<PassengerElements>
<PassengerContactElements>
<DateMonth>0</DateMonth>
<DateYear>0</DateYear>
<WithMobilePercent>0</WithMobilePercent>
<WithEmailPercent>0</WithEmailPercent>
<TotalWithMobile>0</TotalWithMobile>
<TotalWithEmail>0</TotalWithEmail>
<TotalCreated>0</TotalCreated>
</PassengerContactElements>
</PassengerElements>
<ReportUsageSummary>
<ReportPerformance>
<Name>String</Name>
<UrlSlug>String</UrlSlug>
<Total>0</Total>
</ReportPerformance>
</ReportUsageSummary>
<MonthlyActivityFormatted>String</MonthlyActivityFormatted>
<PassengerElementsFormatted>String</PassengerElementsFormatted>
</Item>
</ResponseReport>
<ResponseError>
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<StatusCode>String</StatusCode>
<VerboseMessage>String</VerboseMessage>
</ResponseError>
</AgentivityResponse>