BokaMera.API.Host

<back to all web services

DeleteUser

The following routes are available for this service:
DELETE/usersDeletes a userDeletes the logged in user account.
<?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 UserProfileResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string|null */
        public ?string $Firstname=null,
        /** @var string|null */
        public ?string $Lastname=null,
        /** @var string|null */
        public ?string $Phone=null,
        /** @var string|null */
        public ?string $Email=null
    ) {
    }

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

class AdminProfile implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $CompanyId='',
        /** @var string */
        public string $Id='',
        /** @var string|null */
        public ?string $Firstname=null,
        /** @var string|null */
        public ?string $Lastname=null,
        /** @var string|null */
        public ?string $Email=null,
        /** @var string|null */
        public ?string $WorkerId=null,
        /** @var string|null */
        public ?string $Phone=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['Firstname'])) $this->Firstname = $o['Firstname'];
        if (isset($o['Lastname'])) $this->Lastname = $o['Lastname'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['WorkerId'])) $this->WorkerId = $o['WorkerId'];
        if (isset($o['Phone'])) $this->Phone = $o['Phone'];
    }
    
    /** @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->Firstname)) $o['Firstname'] = $this->Firstname;
        if (isset($this->Lastname)) $o['Lastname'] = $this->Lastname;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->WorkerId)) $o['WorkerId'] = $this->WorkerId;
        if (isset($this->Phone)) $o['Phone'] = $this->Phone;
        return empty($o) ? new class(){} : $o;
    }
}

class DeleteUserResponse implements JsonSerializable
{
    public function __construct(
        /** @var Object|null */
        public ?Object $ResponseStatus=null,
        /** @description The user id for your profile. */
        // @ApiMember(Description="The user id for your profile.", IsRequired=true)
        /** @var string */
        public string $UserName='',

        /** @var UserProfileResponse|null */
        public ?UserProfileResponse $UserProfile=null,
        /** @var AdminProfile|null */
        public ?AdminProfile $AdminProfile=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('Object', $o['ResponseStatus']);
        if (isset($o['UserName'])) $this->UserName = $o['UserName'];
        if (isset($o['UserProfile'])) $this->UserProfile = JsonConverters::from('UserProfileResponse', $o['UserProfile']);
        if (isset($o['AdminProfile'])) $this->AdminProfile = JsonConverters::from('AdminProfile', $o['AdminProfile']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('Object', $this->ResponseStatus);
        if (isset($this->UserName)) $o['UserName'] = $this->UserName;
        if (isset($this->UserProfile)) $o['UserProfile'] = JsonConverters::to('UserProfileResponse', $this->UserProfile);
        if (isset($this->AdminProfile)) $o['AdminProfile'] = JsonConverters::to('AdminProfile', $this->AdminProfile);
        return empty($o) ? new class(){} : $o;
    }
}

enum KeyCloakRealm : int
{
    case BookMore = 1;
    case BookMoreAdmin = 2;
    case SuperAdmin = 3;
}

// @ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
class DeleteUser implements JsonSerializable
{
    public function __construct(
        /** @description The user name of your profile. */
        // @ApiMember(Description="The user name of your profile.", IsRequired=true)
        /** @var string */
        public string $UserName='',

        /** @description The user realm for identity server.  BookMore = 1, BookMoreAdmin = 2  */
        // @ApiMember(Description="The user realm for identity server.  BookMore = 1, BookMoreAdmin = 2 ", IsRequired=true)
        /** @var KeyCloakRealm|null */
        public ?KeyCloakRealm $Realm=null,

        /** @description If this equals true it will force delete all customer profiles on all company on there you have booked a time. */
        // @ApiMember(Description="If this equals true it will force delete all customer profiles on all company on there you have booked a time.")
        /** @var bool|null */
        public ?bool $DeleteCustomerProfiles=null,

        /** @description If this equals true it will check the request token value and try to delete user, if it is false it will send a delete confirmation email. */
        // @ApiMember(Description="If this equals true it will check the request token value and try to delete user, if it is false it will send a delete confirmation email.")
        /** @var bool|null */
        public ?bool $ForceDelete=null,

        /** @description The value is only checked when ForceDelete is set to true. Contains the token value what was sent to email. */
        // @ApiMember(Description="The value is only checked when ForceDelete is set to true. Contains the token value what was sent to email.")
        /** @var string|null */
        public ?string $Token=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['UserName'])) $this->UserName = $o['UserName'];
        if (isset($o['Realm'])) $this->Realm = JsonConverters::from('KeyCloakRealm', $o['Realm']);
        if (isset($o['DeleteCustomerProfiles'])) $this->DeleteCustomerProfiles = $o['DeleteCustomerProfiles'];
        if (isset($o['ForceDelete'])) $this->ForceDelete = $o['ForceDelete'];
        if (isset($o['Token'])) $this->Token = $o['Token'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->UserName)) $o['UserName'] = $this->UserName;
        if (isset($this->Realm)) $o['Realm'] = JsonConverters::to('KeyCloakRealm', $this->Realm);
        if (isset($this->DeleteCustomerProfiles)) $o['DeleteCustomerProfiles'] = $this->DeleteCustomerProfiles;
        if (isset($this->ForceDelete)) $o['ForceDelete'] = $this->ForceDelete;
        if (isset($this->Token)) $o['Token'] = $this->Token;
        return empty($o) ? new class(){} : $o;
    }
}

PHP DeleteUser 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 /users HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ResponseStatus":{},"UserName":"String","UserProfile":{"Firstname":"String","Lastname":"String","Phone":"String","Email":"String"},"AdminProfile":{"Firstname":"String","Lastname":"String","Email":"String","WorkerId":"String","Phone":"String"}}