Required role: | superadmin |
DELETE | /superadmin/company/{Id} | Deletes a customer and everything realted to customer, including administrators and bookings etc. |
---|
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 BaseModel:
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LicenseTypeItem(BaseModel):
# @Ignore()
name: Optional[str] = None
# @Ignore()
license_type: Optional[LicenseType] = None
# @Required()
license_types_id: int = 0
# @Required()
license_items_id: int = 0
# @Required()
number_of_items: int = 0
id: int = 0
modified_date: Optional[datetime.datetime] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Currency(BaseModel):
# @Required()
name: Optional[str] = None
# @Required()
currency_sign: Optional[str] = None
# @Required()
active: bool = False
modified_date: Optional[datetime.datetime] = None
# @Required()
id: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Country(BaseModel):
# @References(typeof(Currency))
currency_id: Optional[str] = None
currency_info: Optional[Currency] = None
# @Required()
name: Optional[str] = None
culture: Optional[str] = None
time_zone: Optional[str] = None
modified_date: Optional[datetime.datetime] = None
# @Required()
id: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LicensePrice(BaseModel):
# @Ignore()
country: Optional[Country] = None
# @Ignore()
monthly_payment: bool = False
# @Required()
license_type_id: int = 0
# @Required()
country_id: Optional[str] = None
# @Required()
price: int = 0
modified_date: Optional[datetime.datetime] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LicenseType(BaseModel):
# @Ignore()
license_items: Optional[IList[LicenseTypeItem]] = None
# @Ignore()
prices: Optional[IList[LicensePrice]] = None
# @Ignore()
is_free: bool = False
# @Ignore()
period_of_notice_days: int = 0
# @Ignore()
next_license_option: Optional[LicenseType] = None
# @Required()
name: Optional[str] = None
# @Required()
description: Optional[str] = None
# @Required()
extra_license_option: bool = False
modified_date: Optional[datetime.datetime] = None
active: bool = False
id: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class License(BaseModel):
type: Optional[LicenseType] = None
# @Required()
company_id: Optional[str] = None
id: int = 0
# @Required()
type_id: int = 0
# @Required()
valid_from: datetime.datetime = datetime.datetime(1, 1, 1)
# @Required()
valid_to: datetime.datetime = datetime.datetime(1, 1, 1)
# @Required()
active: bool = False
# @Required()
updated: datetime.datetime = datetime.datetime(1, 1, 1)
# @Required()
created: datetime.datetime = datetime.datetime(1, 1, 1)
modified_date: Optional[datetime.datetime] = None
meta_data: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DeletedCustomerInfoResponse:
company_id: Optional[str] = None
active_licenses: Optional[List[License]] = None
comment: Optional[str] = None
# @ApiResponse(Description="", StatusCode=400)
# @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DeleteCustomerSuperAdminUser(ICompany):
# @ApiMember(Description="Enter the companyId for the customer", ParameterType="query")
company_id: Optional[str] = None
"""
Enter the companyId for the customer
"""
# @ApiMember(Description="Id (guid) of company you wish to delete.", IsRequired=true)
id: Optional[str] = None
"""
Id (guid) of company you wish to delete.
"""
got_approved_by_admin: bool = False
Python DeleteCustomerSuperAdminUser 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.
DELETE /superadmin/company/{Id} HTTP/1.1 Host: api.bokamera.se Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <DeletedCustomerInfoResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <ActiveLicenses xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Db"> <d2p1:License> <d2p1:Active>false</d2p1:Active> <d2p1:CompanyId>00000000-0000-0000-0000-000000000000</d2p1:CompanyId> <d2p1:Created>0001-01-01T00:00:00</d2p1:Created> <d2p1:Id>0</d2p1:Id> <d2p1:MetaData>String</d2p1:MetaData> <d2p1:ModifiedDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System"> <d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime> <d4p1:OffsetMinutes>0</d4p1:OffsetMinutes> </d2p1:ModifiedDate> <d2p1:Type> <d2p1:Active>false</d2p1:Active> <d2p1:Description>String</d2p1:Description> <d2p1:ExtraLicenseOption>false</d2p1:ExtraLicenseOption> <d2p1:Id>0</d2p1:Id> <d2p1:LicenseItems i:nil="true" /> <d2p1:ModifiedDate xmlns:d5p1="http://schemas.datacontract.org/2004/07/System"> <d5p1:DateTime>0001-01-01T00:00:00Z</d5p1:DateTime> <d5p1:OffsetMinutes>0</d5p1:OffsetMinutes> </d2p1:ModifiedDate> <d2p1:Name>String</d2p1:Name> <d2p1:Prices i:nil="true" /> </d2p1:Type> <d2p1:TypeId>0</d2p1:TypeId> <d2p1:Updated>0001-01-01T00:00:00</d2p1:Updated> <d2p1:ValidFrom>0001-01-01T00:00:00</d2p1:ValidFrom> <d2p1:ValidTo>0001-01-01T00:00:00</d2p1:ValidTo> </d2p1:License> </ActiveLicenses> <Comment>String</Comment> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> </DeletedCustomerInfoResponse>