POST | /superadmin/company/inactive | Evaluates inactive companies and performs deletion or notification based on predefined criteria. |
---|
import 'package:servicestack/servicestack.dart';
enum InactivityAction
{
ActivityReminder,
FinalWarning,
Delete,
}
class InactiveCompanyResult implements IConvertible
{
String? CompanyId;
DateTime? LastActivityDate;
DateTime? LastActivityNotificationDate;
DateTime? DeletionTime;
InactivityAction? Action;
InactiveCompanyResult({this.CompanyId,this.LastActivityDate,this.LastActivityNotificationDate,this.DeletionTime,this.Action});
InactiveCompanyResult.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
LastActivityDate = JsonConverters.fromJson(json['LastActivityDate'],'DateTime',context!);
LastActivityNotificationDate = JsonConverters.fromJson(json['LastActivityNotificationDate'],'DateTime',context!);
DeletionTime = JsonConverters.fromJson(json['DeletionTime'],'DateTime',context!);
Action = JsonConverters.fromJson(json['Action'],'InactivityAction',context!);
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'LastActivityDate': JsonConverters.toJson(LastActivityDate,'DateTime',context!),
'LastActivityNotificationDate': JsonConverters.toJson(LastActivityNotificationDate,'DateTime',context!),
'DeletionTime': JsonConverters.toJson(DeletionTime,'DateTime',context!),
'Action': JsonConverters.toJson(Action,'InactivityAction',context!)
};
getTypeName() => "InactiveCompanyResult";
TypeContext? context = _ctx;
}
class InactiveCompaniesResponse implements IConvertible
{
List<InactiveCompanyResult>? ProcessedCompanies;
InactiveCompaniesResponse({this.ProcessedCompanies});
InactiveCompaniesResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ProcessedCompanies = JsonConverters.fromJson(json['ProcessedCompanies'],'List<InactiveCompanyResult>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ProcessedCompanies': JsonConverters.toJson(ProcessedCompanies,'List<InactiveCompanyResult>',context!)
};
getTypeName() => "InactiveCompaniesResponse";
TypeContext? context = _ctx;
}
class DeleteInactiveCompaniesRequest implements IConvertible
{
/**
* Number of companies to process for deletion or notification in each run.
*/
// @ApiMember(Description="Number of companies to process for deletion or notification in each run.", IsRequired=true)
int? BatchLimit;
DeleteInactiveCompaniesRequest({this.BatchLimit});
DeleteInactiveCompaniesRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
BatchLimit = json['BatchLimit'];
return this;
}
Map<String, dynamic> toJson() => {
'BatchLimit': BatchLimit
};
getTypeName() => "DeleteInactiveCompaniesRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
'InactivityAction': TypeInfo(TypeOf.Enum, enumValues:InactivityAction.values),
'InactiveCompanyResult': TypeInfo(TypeOf.Class, create:() => InactiveCompanyResult()),
'InactiveCompaniesResponse': TypeInfo(TypeOf.Class, create:() => InactiveCompaniesResponse()),
'List<InactiveCompanyResult>': TypeInfo(TypeOf.Class, create:() => <InactiveCompanyResult>[]),
'DeleteInactiveCompaniesRequest': TypeInfo(TypeOf.Class, create:() => DeleteInactiveCompaniesRequest()),
});
Dart 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>