| POST | /bettors/register |
|---|
<?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 Reference implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $value=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['value'])) $this->value = $o['value'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->value)) $o['value'] = $this->value;
return empty($o) ? new class(){} : $o;
}
}
class Address implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $street=null,
/** @var Reference|null */
public ?Reference $city=null,
/** @var string|null */
public ?string $postalCode=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['street'])) $this->street = $o['street'];
if (isset($o['city'])) $this->city = JsonConverters::from('Reference', $o['city']);
if (isset($o['postalCode'])) $this->postalCode = $o['postalCode'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->street)) $o['street'] = $this->street;
if (isset($this->city)) $o['city'] = JsonConverters::to('Reference', $this->city);
if (isset($this->postalCode)) $o['postalCode'] = $this->postalCode;
return empty($o) ? new class(){} : $o;
}
}
enum BettorType : int
{
case Internet = 0;
case SMS = 1;
}
class RegisterBettor implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $fullName=null,
/** @var DateTime */
public DateTime $dateOfBirth=new DateTime(),
/** @var string|null */
public ?string $jmbg=null,
/** @var Address|null */
public ?Address $bettorAddress=null,
/** @var string|null */
public ?string $email=null,
/** @var string|null */
public ?string $phoneNumber=null,
/** @var string|null */
public ?string $username=null,
/** @var string|null */
public ?string $bankTransactionAccountNumber=null,
/** @var BettorType|null */
public ?BettorType $bettorType=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['fullName'])) $this->fullName = $o['fullName'];
if (isset($o['dateOfBirth'])) $this->dateOfBirth = JsonConverters::from('DateTime', $o['dateOfBirth']);
if (isset($o['jmbg'])) $this->jmbg = $o['jmbg'];
if (isset($o['bettorAddress'])) $this->bettorAddress = JsonConverters::from('Address', $o['bettorAddress']);
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['phoneNumber'])) $this->phoneNumber = $o['phoneNumber'];
if (isset($o['username'])) $this->username = $o['username'];
if (isset($o['bankTransactionAccountNumber'])) $this->bankTransactionAccountNumber = $o['bankTransactionAccountNumber'];
if (isset($o['bettorType'])) $this->bettorType = JsonConverters::from('BettorType', $o['bettorType']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->fullName)) $o['fullName'] = $this->fullName;
if (isset($this->dateOfBirth)) $o['dateOfBirth'] = JsonConverters::to('DateTime', $this->dateOfBirth);
if (isset($this->jmbg)) $o['jmbg'] = $this->jmbg;
if (isset($this->bettorAddress)) $o['bettorAddress'] = JsonConverters::to('Address', $this->bettorAddress);
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->phoneNumber)) $o['phoneNumber'] = $this->phoneNumber;
if (isset($this->username)) $o['username'] = $this->username;
if (isset($this->bankTransactionAccountNumber)) $o['bankTransactionAccountNumber'] = $this->bankTransactionAccountNumber;
if (isset($this->bettorType)) $o['bettorType'] = JsonConverters::to('BettorType', $this->bettorType);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bettors/register HTTP/1.1
Host: fbihtaapi.bettor.webhop.biz
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"id":"String","fullName":"String","dateOfBirth":"0001-01-01T00:00:00.0000000Z","jmbg":"String","bettorAddress":{"street":"String","city":{"id":"String","value":"String"},"postalCode":"String"},"email":"String","phoneNumber":"String","username":"String","bankTransactionAccountNumber":"String","bettorType":0}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}