POST | /superadmin/company/inactive | Evaluates inactive companies and performs deletion or notification based on predefined criteria. |
---|
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
class InactivityAction(str, Enum):
ACTIVITY_REMINDER = 'ActivityReminder'
FINAL_WARNING = 'FinalWarning'
DELETE = 'Delete'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InactiveCompanyResult:
company_id: Optional[str] = None
last_activity_date: datetime.datetime = datetime.datetime(1, 1, 1)
last_activity_notification_date: datetime.datetime = datetime.datetime(1, 1, 1)
deletion_time: datetime.datetime = datetime.datetime(1, 1, 1)
action: Optional[InactivityAction] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InactiveCompaniesResponse:
processed_companies: Optional[List[InactiveCompanyResult]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DeleteInactiveCompaniesRequest:
# @ApiMember(Description="Number of companies to process for deletion or notification in each run.", IsRequired=true)
batch_limit: Optional[int] = None
"""
Number of companies to process for deletion or notification in each run.
"""
Python DeleteInactiveCompaniesRequest 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.
POST /superadmin/company/inactive HTTP/1.1
Host: testapi.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<DeleteInactiveCompaniesRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<BatchLimit>0</BatchLimit>
</DeleteInactiveCompaniesRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <InactiveCompaniesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <ProcessedCompanies> <InactiveCompanyResult> <Action>ActivityReminder</Action> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <DeletionTime>0001-01-01T00:00:00</DeletionTime> <LastActivityDate>0001-01-01T00:00:00</LastActivityDate> <LastActivityNotificationDate>0001-01-01T00:00:00</LastActivityNotificationDate> </InactiveCompanyResult> </ProcessedCompanies> </InactiveCompaniesResponse>