BokaMera.API.Host

<back to all web services

DeleteCustomerSuperAdminUser

Requires Authentication
Required role:superadmin
The following routes are available for this service:
DELETE/superadmin/company/{Id}Deletes a customer and everything realted to customer, including administrators and bookings etc.
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class BaseModel implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

class LicenseTypeItem extends BaseModel implements JsonSerializable
{
    public function __construct(
        // @Ignore()
        /** @var string|null */
        public ?string $Name=null,

        // @Ignore()
        /** @var LicenseType|null */
        public ?LicenseType $LicenseType=null,

        // @Required()
        /** @var int */
        public int $LicenseTypesId=0,

        // @Required()
        /** @var int */
        public int $LicenseItemsId=0,

        // @Required()
        /** @var int */
        public int $NumberOfItems=0,

        /** @var int */
        public int $Id=0,
        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['LicenseType'])) $this->LicenseType = JsonConverters::from('LicenseType', $o['LicenseType']);
        if (isset($o['LicenseTypesId'])) $this->LicenseTypesId = $o['LicenseTypesId'];
        if (isset($o['LicenseItemsId'])) $this->LicenseItemsId = $o['LicenseItemsId'];
        if (isset($o['NumberOfItems'])) $this->NumberOfItems = $o['NumberOfItems'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->LicenseType)) $o['LicenseType'] = JsonConverters::to('LicenseType', $this->LicenseType);
        if (isset($this->LicenseTypesId)) $o['LicenseTypesId'] = $this->LicenseTypesId;
        if (isset($this->LicenseItemsId)) $o['LicenseItemsId'] = $this->LicenseItemsId;
        if (isset($this->NumberOfItems)) $o['NumberOfItems'] = $this->NumberOfItems;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
        return empty($o) ? new class(){} : $o;
    }
}

class Currency extends BaseModel implements JsonSerializable
{
    public function __construct(
        // @Required()
        /** @var string */
        public string $Name='',

        // @Required()
        /** @var string */
        public string $CurrencySign='',

        // @Required()
        /** @var bool|null */
        public ?bool $Active=null,

        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null,
        // @Required()
        /** @var string */
        public string $Id=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['CurrencySign'])) $this->CurrencySign = $o['CurrencySign'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
        if (isset($o['Id'])) $this->Id = $o['Id'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->CurrencySign)) $o['CurrencySign'] = $this->CurrencySign;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
        if (isset($this->Id)) $o['Id'] = $this->Id;
        return empty($o) ? new class(){} : $o;
    }
}

class Country extends BaseModel implements JsonSerializable
{
    public function __construct(
        // @References("typeof(BokaMera.API.ServiceModel.Db.Currency)")
        /** @var string|null */
        public ?string $CurrencyId=null,

        /** @var Currency|null */
        public ?Currency $CurrencyInfo=null,
        // @Required()
        /** @var string */
        public string $Name='',

        /** @var string|null */
        public ?string $Culture=null,
        /** @var string|null */
        public ?string $TimeZone=null,
        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null,
        // @Required()
        /** @var string */
        public string $Id=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
        if (isset($o['CurrencyInfo'])) $this->CurrencyInfo = JsonConverters::from('Currency', $o['CurrencyInfo']);
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Culture'])) $this->Culture = $o['Culture'];
        if (isset($o['TimeZone'])) $this->TimeZone = $o['TimeZone'];
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
        if (isset($o['Id'])) $this->Id = $o['Id'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
        if (isset($this->CurrencyInfo)) $o['CurrencyInfo'] = JsonConverters::to('Currency', $this->CurrencyInfo);
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Culture)) $o['Culture'] = $this->Culture;
        if (isset($this->TimeZone)) $o['TimeZone'] = $this->TimeZone;
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
        if (isset($this->Id)) $o['Id'] = $this->Id;
        return empty($o) ? new class(){} : $o;
    }
}

class LicensePrice extends BaseModel implements JsonSerializable
{
    public function __construct(
        // @Ignore()
        /** @var Country|null */
        public ?Country $Country=null,

        // @Ignore()
        /** @var bool|null */
        public ?bool $MonthlyPayment=null,

        // @Required()
        /** @var int */
        public int $LicenseTypeId=0,

        // @Required()
        /** @var string */
        public string $CountryId='',

        // @Required()
        /** @var int */
        public int $Price=0,

        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['Country'])) $this->Country = JsonConverters::from('Country', $o['Country']);
        if (isset($o['MonthlyPayment'])) $this->MonthlyPayment = $o['MonthlyPayment'];
        if (isset($o['LicenseTypeId'])) $this->LicenseTypeId = $o['LicenseTypeId'];
        if (isset($o['CountryId'])) $this->CountryId = $o['CountryId'];
        if (isset($o['Price'])) $this->Price = $o['Price'];
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->Country)) $o['Country'] = JsonConverters::to('Country', $this->Country);
        if (isset($this->MonthlyPayment)) $o['MonthlyPayment'] = $this->MonthlyPayment;
        if (isset($this->LicenseTypeId)) $o['LicenseTypeId'] = $this->LicenseTypeId;
        if (isset($this->CountryId)) $o['CountryId'] = $this->CountryId;
        if (isset($this->Price)) $o['Price'] = $this->Price;
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
        return empty($o) ? new class(){} : $o;
    }
}

class LicenseType extends BaseModel implements JsonSerializable
{
    public function __construct(
        // @Ignore()
        /** @var array<LicenseTypeItem>|null */
        public ?array $LicenseItems=null,

        // @Ignore()
        /** @var array<LicensePrice>|null */
        public ?array $Prices=null,

        // @Ignore()
        /** @var int */
        public int $PeriodOfNoticeDays=0,

        // @Ignore()
        /** @var LicenseType|null */
        public ?LicenseType $NextLicenseOption=null,

        // @Required()
        /** @var string */
        public string $Name='',

        // @Required()
        /** @var string */
        public string $Description='',

        // @Required()
        /** @var bool|null */
        public ?bool $ExtraLicenseOption=null,

        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null,
        /** @var bool|null */
        public ?bool $Active=null,
        /** @var int */
        public int $Id=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['LicenseItems'])) $this->LicenseItems = JsonConverters::fromArray('LicenseTypeItem', $o['LicenseItems']);
        if (isset($o['Prices'])) $this->Prices = JsonConverters::fromArray('LicensePrice', $o['Prices']);
        if (isset($o['PeriodOfNoticeDays'])) $this->PeriodOfNoticeDays = $o['PeriodOfNoticeDays'];
        if (isset($o['NextLicenseOption'])) $this->NextLicenseOption = JsonConverters::from('LicenseType', $o['NextLicenseOption']);
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['ExtraLicenseOption'])) $this->ExtraLicenseOption = $o['ExtraLicenseOption'];
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->LicenseItems)) $o['LicenseItems'] = JsonConverters::toArray('LicenseTypeItem', $this->LicenseItems);
        if (isset($this->Prices)) $o['Prices'] = JsonConverters::toArray('LicensePrice', $this->Prices);
        if (isset($this->PeriodOfNoticeDays)) $o['PeriodOfNoticeDays'] = $this->PeriodOfNoticeDays;
        if (isset($this->NextLicenseOption)) $o['NextLicenseOption'] = JsonConverters::to('LicenseType', $this->NextLicenseOption);
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->ExtraLicenseOption)) $o['ExtraLicenseOption'] = $this->ExtraLicenseOption;
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        return empty($o) ? new class(){} : $o;
    }
}

class License extends BaseModel implements JsonSerializable
{
    public function __construct(
        /** @var LicenseType|null */
        public ?LicenseType $Type=null,
        // @Required()
        /** @var string */
        public string $CompanyId='',

        /** @var int */
        public int $Id=0,
        // @Required()
        /** @var int */
        public int $TypeId=0,

        // @Required()
        /** @var DateTime */
        public DateTime $ValidFrom=new DateTime(),

        // @Required()
        /** @var DateTime */
        public DateTime $ValidTo=new DateTime(),

        // @Required()
        /** @var bool|null */
        public ?bool $Active=null,

        // @Required()
        /** @var DateTime */
        public DateTime $Updated=new DateTime(),

        // @Required()
        /** @var DateTime */
        public DateTime $Created=new DateTime(),

        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null,
        /** @var string|null */
        public ?string $MetaData=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['Type'])) $this->Type = JsonConverters::from('LicenseType', $o['Type']);
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['TypeId'])) $this->TypeId = $o['TypeId'];
        if (isset($o['ValidFrom'])) $this->ValidFrom = JsonConverters::from('DateTime', $o['ValidFrom']);
        if (isset($o['ValidTo'])) $this->ValidTo = JsonConverters::from('DateTime', $o['ValidTo']);
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
        if (isset($o['MetaData'])) $this->MetaData = $o['MetaData'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->Type)) $o['Type'] = JsonConverters::to('LicenseType', $this->Type);
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->TypeId)) $o['TypeId'] = $this->TypeId;
        if (isset($this->ValidFrom)) $o['ValidFrom'] = JsonConverters::to('DateTime', $this->ValidFrom);
        if (isset($this->ValidTo)) $o['ValidTo'] = JsonConverters::to('DateTime', $this->ValidTo);
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
        if (isset($this->MetaData)) $o['MetaData'] = $this->MetaData;
        return empty($o) ? new class(){} : $o;
    }
}

class DeletedCustomerInfoResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CompanyId=null,
        /** @var array<License>|null */
        public ?array $ActiveLicenses=null,
        /** @var string|null */
        public ?string $Comment=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['ActiveLicenses'])) $this->ActiveLicenses = JsonConverters::fromArray('License', $o['ActiveLicenses']);
        if (isset($o['Comment'])) $this->Comment = $o['Comment'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->ActiveLicenses)) $o['ActiveLicenses'] = JsonConverters::toArray('License', $this->ActiveLicenses);
        if (isset($this->Comment)) $o['Comment'] = $this->Comment;
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="", StatusCode=400)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
class DeleteCustomerSuperAdminUser implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description Enter the companyId for the customer */
        // @ApiMember(Description="Enter the companyId for the customer", ParameterType="query")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description Id (guid) of company you wish to delete. */
        // @ApiMember(Description="Id (guid) of company you wish to delete.", IsRequired=true)
        /** @var string */
        public string $Id='',

        /** @var bool|null */
        public ?bool $GotApprovedByAdmin=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['GotApprovedByAdmin'])) $this->GotApprovedByAdmin = $o['GotApprovedByAdmin'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->GotApprovedByAdmin)) $o['GotApprovedByAdmin'] = $this->GotApprovedByAdmin;
        return empty($o) ? new class(){} : $o;
    }
}

PHP DeleteCustomerSuperAdminUser DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

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: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{Unable to show example output for type 'DeletedCustomerInfoResponse' using the custom 'csv' filter}One or more errors occurred. (License type not handled in NextLicenseOption)