Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
DELETE | /customers/{CustomerId}/comments/{Id} | Delete a customers comments | Get all connected customer comments for the company. |
---|
<?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 CustomerCommentsResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string */
public string $CustomerId='',
/** @var string|null */
public ?string $Comments=null,
/** @var DateTime */
public DateTime $Updated=new DateTime(),
/** @var DateTime */
public DateTime $Created=new DateTime(),
/** @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['CustomerId'])) $this->CustomerId = $o['CustomerId'];
if (isset($o['Comments'])) $this->Comments = $o['Comments'];
if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
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->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->Comments)) $o['Comments'] = $this->Comments;
if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
return empty($o) ? new class(){} : $o;
}
}
// @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)
// @ValidateRequest(Validator="IsAuthenticated")
class DeleteCustomerComments implements ICompany, JsonSerializable
{
public function __construct(
// @ApiMember(IsRequired=true, ParameterType="path")
/** @var int */
public int $Id=0,
// @ApiMember(IsRequired=true, ParameterType="path")
/** @var string */
public string $CustomerId='',
// @ApiMember()
/** @var string|null */
public ?string $CompanyId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
return empty($o) ? new class(){} : $o;
}
}
PHP DeleteCustomerComments DTOs
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.
DELETE /customers/{CustomerId}/comments/{Id} HTTP/1.1 Host: api.bokamera.se Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Id":0,"Comments":"String"}