MBFSPreferences

<back to all web services

CustomerPreferencesRequest

The following routes are available for this service:
All Verbs/CustomerPreferences/
<?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 Response implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $Message=null
    ) {
    }

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

class MarketingPreference implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $OptInMail=null,
        /** @var string|null */
        public ?string $OptInTelephone=null,
        /** @var string|null */
        public ?string $OptInEmail=null,
        /** @var string|null */
        public ?string $OptInSMS=null,
        /** @var string|null */
        public ?string $TimeStamp=null,
        /** @var bool|null */
        public ?bool $MMF_Portal_Registered=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['OptInMail'])) $this->OptInMail = $o['OptInMail'];
        if (isset($o['OptInTelephone'])) $this->OptInTelephone = $o['OptInTelephone'];
        if (isset($o['OptInEmail'])) $this->OptInEmail = $o['OptInEmail'];
        if (isset($o['OptInSMS'])) $this->OptInSMS = $o['OptInSMS'];
        if (isset($o['TimeStamp'])) $this->TimeStamp = $o['TimeStamp'];
        if (isset($o['MMF_Portal_Registered'])) $this->MMF_Portal_Registered = $o['MMF_Portal_Registered'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->OptInMail)) $o['OptInMail'] = $this->OptInMail;
        if (isset($this->OptInTelephone)) $o['OptInTelephone'] = $this->OptInTelephone;
        if (isset($this->OptInEmail)) $o['OptInEmail'] = $this->OptInEmail;
        if (isset($this->OptInSMS)) $o['OptInSMS'] = $this->OptInSMS;
        if (isset($this->TimeStamp)) $o['TimeStamp'] = $this->TimeStamp;
        if (isset($this->MMF_Portal_Registered)) $o['MMF_Portal_Registered'] = $this->MMF_Portal_Registered;
        return empty($o) ? new class(){} : $o;
    }
}

class CustomerPreferencesResponse implements JsonSerializable
{
    public function __construct(
        /** @var Response|null */
        public ?Response $ResponseStatus=null,
        /** @var MarketingPreference|null */
        public ?MarketingPreference $MarketingPreference=null
    ) {
    }

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

class CustomerPreferencesRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $BP_ID=null,
        /** @var string|null */
        public ?string $Username=null,
        /** @var string|null */
        public ?string $Token=null,
        /** @var string|null */
        public ?string $Timestamp=null
    ) {
    }

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

PHP CustomerPreferencesRequest DTOs

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

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /CustomerPreferences/ HTTP/1.1 
Host: webservices.mbukdatabase.co.uk 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CustomerPreferencesRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MBFSPreferences.ServiceModel">
  <BP_ID>String</BP_ID>
  <Timestamp>String</Timestamp>
  <Token>String</Token>
  <Username>String</Username>
</CustomerPreferencesRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CustomerPreferencesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MBFSPreferences.ServiceModel">
  <MarketingPreference>
    <MMF_Portal_Registered>false</MMF_Portal_Registered>
    <OptInEmail>String</OptInEmail>
    <OptInMail>String</OptInMail>
    <OptInSMS>String</OptInSMS>
    <OptInTelephone>String</OptInTelephone>
    <TimeStamp>String</TimeStamp>
  </MarketingPreference>
  <ResponseStatus>
    <Code>String</Code>
    <Message>String</Message>
  </ResponseStatus>
</CustomerPreferencesResponse>