ServiceStack Home (Live)

<back to all web services

AccountSettings

Requires Authentication
The following routes are available for this service:
All Verbs/account/settings
GET POST/AccountSettings
<?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 AccountSettings implements IPost, JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $displayName=null,
        /** @var string|null */
        public ?string $firstName=null,
        /** @var string|null */
        public ?string $lastName=null,
        /** @var string|null */
        public ?string $company=null,
        /** @var string|null */
        public ?string $phoneNumber=null,
        /** @var bool|null */
        public ?bool $showCard=null,
        /** @var string|null */
        public ?string $brand=null,
        /** @var string|null */
        public ?string $last4=null,
        /** @var string|null */
        public ?string $cardNumber=null,
        /** @var string|null */
        public ?string $cvc=null,
        /** @var int */
        public int $expMonth=0,
        /** @var int */
        public int $expYear=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['displayName'])) $this->displayName = $o['displayName'];
        if (isset($o['firstName'])) $this->firstName = $o['firstName'];
        if (isset($o['lastName'])) $this->lastName = $o['lastName'];
        if (isset($o['company'])) $this->company = $o['company'];
        if (isset($o['phoneNumber'])) $this->phoneNumber = $o['phoneNumber'];
        if (isset($o['showCard'])) $this->showCard = $o['showCard'];
        if (isset($o['brand'])) $this->brand = $o['brand'];
        if (isset($o['last4'])) $this->last4 = $o['last4'];
        if (isset($o['cardNumber'])) $this->cardNumber = $o['cardNumber'];
        if (isset($o['cvc'])) $this->cvc = $o['cvc'];
        if (isset($o['expMonth'])) $this->expMonth = $o['expMonth'];
        if (isset($o['expYear'])) $this->expYear = $o['expYear'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->displayName)) $o['displayName'] = $this->displayName;
        if (isset($this->firstName)) $o['firstName'] = $this->firstName;
        if (isset($this->lastName)) $o['lastName'] = $this->lastName;
        if (isset($this->company)) $o['company'] = $this->company;
        if (isset($this->phoneNumber)) $o['phoneNumber'] = $this->phoneNumber;
        if (isset($this->showCard)) $o['showCard'] = $this->showCard;
        if (isset($this->brand)) $o['brand'] = $this->brand;
        if (isset($this->last4)) $o['last4'] = $this->last4;
        if (isset($this->cardNumber)) $o['cardNumber'] = $this->cardNumber;
        if (isset($this->cvc)) $o['cvc'] = $this->cvc;
        if (isset($this->expMonth)) $o['expMonth'] = $this->expMonth;
        if (isset($this->expYear)) $o['expYear'] = $this->expYear;
        return empty($o) ? new class(){} : $o;
    }
}

PHP AccountSettings DTOs

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

HTTP + JSV

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

POST /account/settings HTTP/1.1 
Host: account.servicestack.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	displayName: String,
	firstName: String,
	lastName: String,
	company: String,
	phoneNumber: String,
	showCard: False,
	brand: String,
	last4: String,
	cardNumber: String,
	cvc: String,
	expMonth: 0,
	expYear: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	displayName: String,
	firstName: String,
	lastName: String,
	company: String,
	phoneNumber: String,
	showCard: False,
	brand: String,
	last4: String,
	cardNumber: String,
	cvc: String,
	expMonth: 0,
	expYear: 0
}