Requires any of the roles: | bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read |
GET | /newsletter/customers | Get all customers that are valid for sending newsletters to. | Get all customers that are valid for sending newsletters to. |
---|
<?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 NewsletterCustomerInfo 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 $Email=null,
/** @var string|null */
public ?string $Phone=null,
/** @var string|null */
public ?string $FacebookUserName=null,
/** @var string|null */
public ?string $ImageUrl=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['Email'])) $this->Email = $o['Email'];
if (isset($o['Phone'])) $this->Phone = $o['Phone'];
if (isset($o['FacebookUserName'])) $this->FacebookUserName = $o['FacebookUserName'];
if (isset($o['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
}
/** @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->Email)) $o['Email'] = $this->Email;
if (isset($this->Phone)) $o['Phone'] = $this->Phone;
if (isset($this->FacebookUserName)) $o['FacebookUserName'] = $this->FacebookUserName;
if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
return empty($o) ? new class(){} : $o;
}
}
class NewsletterCustomerQueryResponse implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Id='',
/** @var NewsletterCustomerInfo|null */
public ?NewsletterCustomerInfo $Customer=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Customer'])) $this->Customer = JsonConverters::from('NewsletterCustomerInfo', $o['Customer']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Customer)) $o['Customer'] = JsonConverters::to('NewsletterCustomerInfo', $this->Customer);
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class NewsletterCustomerQuery implements ICompany, JsonSerializable
{
public function __construct(
/** @description The company id, if empty will use the company id for the user you are logged in with. */
// @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
/** @var string|null */
public ?string $CompanyId=null,
/** @description Search for customer has done minimum number of bookings. */
// @ApiMember(Description="Search for customer has done minimum number of bookings.")
/** @var int|null */
public ?int $CustomerMinBookings=null,
/** @description Search for customer has done maximum number of bookings. */
// @ApiMember(Description="Search for customer has done maximum number of bookings.")
/** @var int|null */
public ?int $CustomerMaxBookings=null,
/** @description Search for customer has booked any of the service in the list (List contain service id's). */
// @ApiMember(Description="Search for customer has booked any of the service in the list (List contain service id's).")
/** @var int[]|null */
public ?array $BookedServiceIds=null,
/** @description Search interval From datetime . */
// @ApiMember(Description="Search interval From datetime .")
/** @var DateTime|null */
public ?DateTime $From=null,
/** @description Search interval To datetime . */
// @ApiMember(Description="Search interval To datetime .")
/** @var DateTime|null */
public ?DateTime $To=null,
/** @description The max number of records you want to collect */
// @ApiMember(Description="The max number of records you want to collect")
/** @var int|null */
public ?int $MaxRecords=null,
/** @description If you want to include the full customer information in the response */
// @ApiMember(Description="If you want to include the full customer information in the response")
/** @var bool|null */
public ?bool $IncludeCustomerInformation=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['CustomerMinBookings'])) $this->CustomerMinBookings = $o['CustomerMinBookings'];
if (isset($o['CustomerMaxBookings'])) $this->CustomerMaxBookings = $o['CustomerMaxBookings'];
if (isset($o['BookedServiceIds'])) $this->BookedServiceIds = JsonConverters::fromArray('int', $o['BookedServiceIds']);
if (isset($o['From'])) $this->From = JsonConverters::from('DateTime', $o['From']);
if (isset($o['To'])) $this->To = JsonConverters::from('DateTime', $o['To']);
if (isset($o['MaxRecords'])) $this->MaxRecords = $o['MaxRecords'];
if (isset($o['IncludeCustomerInformation'])) $this->IncludeCustomerInformation = $o['IncludeCustomerInformation'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->CustomerMinBookings)) $o['CustomerMinBookings'] = $this->CustomerMinBookings;
if (isset($this->CustomerMaxBookings)) $o['CustomerMaxBookings'] = $this->CustomerMaxBookings;
if (isset($this->BookedServiceIds)) $o['BookedServiceIds'] = JsonConverters::toArray('int', $this->BookedServiceIds);
if (isset($this->From)) $o['From'] = JsonConverters::to('DateTime', $this->From);
if (isset($this->To)) $o['To'] = JsonConverters::to('DateTime', $this->To);
if (isset($this->MaxRecords)) $o['MaxRecords'] = $this->MaxRecords;
if (isset($this->IncludeCustomerInformation)) $o['IncludeCustomerInformation'] = $this->IncludeCustomerInformation;
return empty($o) ? new class(){} : $o;
}
}
PHP NewsletterCustomerQuery DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /newsletter/customers HTTP/1.1 Host: api.bokamera.se Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","FacebookUserName":"String"}}