Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /support/cases | Add a new support case | Add a new support case to the company of the currently logged in user, only administrators are allowed to add support cases. |
---|
<?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 SupportCaseStatusResponse implements JsonSerializable
{
public function __construct(
/** @description The status id */
// @ApiMember(Description="The status id")
/** @var int */
public int $Id=0,
/** @description The status name */
// @ApiMember(Description="The status name")
/** @var string|null */
public ?string $Name=null,
/** @description The status description */
// @ApiMember(Description="The status description")
/** @var string|null */
public ?string $Description=null,
/** @description The status icon */
// @ApiMember(Description="The status icon")
/** @var string|null */
public ?string $Icon=null,
/** @description The status color */
// @ApiMember(Description="The status color")
/** @var string|null */
public ?string $Color=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Icon'])) $this->Icon = $o['Icon'];
if (isset($o['Color'])) $this->Color = $o['Color'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Icon)) $o['Icon'] = $this->Icon;
if (isset($this->Color)) $o['Color'] = $this->Color;
return empty($o) ? new class(){} : $o;
}
}
class SupportCaseTypeResponse implements JsonSerializable
{
public function __construct(
/** @description The type id */
// @ApiMember(Description="The type id")
/** @var int */
public int $Id=0,
/** @description The type name */
// @ApiMember(Description="The type name")
/** @var string|null */
public ?string $Name=null,
/** @description The type description */
// @ApiMember(Description="The type description")
/** @var string|null */
public ?string $Description=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
return empty($o) ? new class(){} : $o;
}
}
class SupportCaseAreaResponse implements JsonSerializable
{
public function __construct(
/** @description The area id */
// @ApiMember(Description="The area id")
/** @var int */
public int $Id=0,
/** @description The area name */
// @ApiMember(Description="The area name")
/** @var string|null */
public ?string $Name=null,
/** @description The area description */
// @ApiMember(Description="The area description")
/** @var string|null */
public ?string $Description=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
return empty($o) ? new class(){} : $o;
}
}
class SupportCaseCommentsResponse implements JsonSerializable
{
public function __construct(
/** @description The case id */
// @ApiMember(Description="The case id")
/** @var int */
public int $SupportCaseId=0,
/** @description The comments id */
// @ApiMember(Description="The comments id")
/** @var int */
public int $Id=0,
/** @description The case comment */
// @ApiMember(Description="The case comment")
/** @var string|null */
public ?string $Comment=null,
/** @description The case comment created by */
// @ApiMember(Description="The case comment created by")
/** @var string|null */
public ?string $CreatedBy=null,
/** @description The case comment created date */
// @ApiMember(Description="The case comment created date")
/** @var DateTime */
public DateTime $Created=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['SupportCaseId'])) $this->SupportCaseId = $o['SupportCaseId'];
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Comment'])) $this->Comment = $o['Comment'];
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->SupportCaseId)) $o['SupportCaseId'] = $this->SupportCaseId;
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Comment)) $o['Comment'] = $this->Comment;
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
return empty($o) ? new class(){} : $o;
}
}
class SupportCaseAttachmentResponse implements JsonSerializable
{
public function __construct(
/** @description The attachment id */
// @ApiMember(Description="The attachment id")
/** @var int */
public int $Id=0,
/** @description The attachment file url */
// @ApiMember(Description="The attachment file url")
/** @var string|null */
public ?string $FileUrl=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['FileUrl'])) $this->FileUrl = $o['FileUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->FileUrl)) $o['FileUrl'] = $this->FileUrl;
return empty($o) ? new class(){} : $o;
}
}
class SupportCaseQueryResponse implements JsonSerializable
{
public function __construct(
/** @description The support case id */
// @ApiMember(Description="The support case id")
/** @var int */
public int $Id=0,
/** @description The company user id */
// @ApiMember(Description="The company user id")
/** @var string */
public string $CompanyUserId='',
/** @description The case title. */
// @ApiMember(Description="The case title.")
/** @var string|null */
public ?string $Title=null,
/** @description The case description. */
// @ApiMember(Description="The case description.")
/** @var string|null */
public ?string $Description=null,
/** @description The case status id. */
// @ApiMember(Description="The case status id.")
/** @var int */
public int $CaseStatusId=0,
/** @description If the case type id. */
// @ApiMember(Description="If the case type id.")
/** @var int */
public int $CaseTypeId=0,
/** @description If the case area id. */
// @ApiMember(Description="If the case area id.")
/** @var int */
public int $CaseAreaId=0,
/** @description The case created by. */
// @ApiMember(Description="The case created by.")
/** @var string|null */
public ?string $CreatedBy=null,
/** @description The case updated by. */
// @ApiMember(Description="The case updated by.")
/** @var string|null */
public ?string $UpdatedBy=null,
/** @description The case solved by. */
// @ApiMember(Description="The case solved by.")
/** @var string|null */
public ?string $SolvedBy=null,
/** @description If case updated date. */
// @ApiMember(Description="If case updated date.")
/** @var DateTime */
public DateTime $Updated=new DateTime(),
/** @description If case created date. */
// @ApiMember(Description="If case created date.")
/** @var DateTime */
public DateTime $Created=new DateTime(),
/** @description Who owns the support case. */
// @ApiMember(Description="Who owns the support case.")
/** @var string|null */
public ?string $CaseOwner=null,
/** @description The case status information. */
// @ApiMember(Description="The case status information.")
/** @var SupportCaseStatusResponse|null */
public ?SupportCaseStatusResponse $CaseStatus=null,
/** @description The case type information. */
// @ApiMember(Description="The case type information.")
/** @var SupportCaseTypeResponse|null */
public ?SupportCaseTypeResponse $CaseType=null,
/** @description The case area information. */
// @ApiMember(Description="The case area information.")
/** @var SupportCaseAreaResponse|null */
public ?SupportCaseAreaResponse $CaseArea=null,
/** @description The case comments. */
// @ApiMember(Description="The case comments.")
/** @var array<SupportCaseCommentsResponse>|null */
public ?array $Comments=null,
/** @description The case attachments. */
// @ApiMember(Description="The case attachments.")
/** @var array<SupportCaseAttachmentResponse>|null */
public ?array $Attachments=null,
/** @description The case status options to select from. */
// @ApiMember(Description="The case status options to select from.")
/** @var array<SupportCaseStatusResponse>|null */
public ?array $CaseStatusOptions=null,
/** @description The case type options to select from. */
// @ApiMember(Description="The case type options to select from.")
/** @var array<SupportCaseTypeResponse>|null */
public ?array $CaseTypeOptions=null,
/** @description The case area options to select from. */
// @ApiMember(Description="The case area options to select from.")
/** @var array<SupportCaseAreaResponse>|null */
public ?array $CaseAreaOptions=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['CompanyUserId'])) $this->CompanyUserId = $o['CompanyUserId'];
if (isset($o['Title'])) $this->Title = $o['Title'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['CaseStatusId'])) $this->CaseStatusId = $o['CaseStatusId'];
if (isset($o['CaseTypeId'])) $this->CaseTypeId = $o['CaseTypeId'];
if (isset($o['CaseAreaId'])) $this->CaseAreaId = $o['CaseAreaId'];
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
if (isset($o['UpdatedBy'])) $this->UpdatedBy = $o['UpdatedBy'];
if (isset($o['SolvedBy'])) $this->SolvedBy = $o['SolvedBy'];
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['CaseOwner'])) $this->CaseOwner = $o['CaseOwner'];
if (isset($o['CaseStatus'])) $this->CaseStatus = JsonConverters::from('SupportCaseStatusResponse', $o['CaseStatus']);
if (isset($o['CaseType'])) $this->CaseType = JsonConverters::from('SupportCaseTypeResponse', $o['CaseType']);
if (isset($o['CaseArea'])) $this->CaseArea = JsonConverters::from('SupportCaseAreaResponse', $o['CaseArea']);
if (isset($o['Comments'])) $this->Comments = JsonConverters::fromArray('SupportCaseCommentsResponse', $o['Comments']);
if (isset($o['Attachments'])) $this->Attachments = JsonConverters::fromArray('SupportCaseAttachmentResponse', $o['Attachments']);
if (isset($o['CaseStatusOptions'])) $this->CaseStatusOptions = JsonConverters::fromArray('SupportCaseStatusResponse', $o['CaseStatusOptions']);
if (isset($o['CaseTypeOptions'])) $this->CaseTypeOptions = JsonConverters::fromArray('SupportCaseTypeResponse', $o['CaseTypeOptions']);
if (isset($o['CaseAreaOptions'])) $this->CaseAreaOptions = JsonConverters::fromArray('SupportCaseAreaResponse', $o['CaseAreaOptions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->CompanyUserId)) $o['CompanyUserId'] = $this->CompanyUserId;
if (isset($this->Title)) $o['Title'] = $this->Title;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->CaseStatusId)) $o['CaseStatusId'] = $this->CaseStatusId;
if (isset($this->CaseTypeId)) $o['CaseTypeId'] = $this->CaseTypeId;
if (isset($this->CaseAreaId)) $o['CaseAreaId'] = $this->CaseAreaId;
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
if (isset($this->UpdatedBy)) $o['UpdatedBy'] = $this->UpdatedBy;
if (isset($this->SolvedBy)) $o['SolvedBy'] = $this->SolvedBy;
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->CaseOwner)) $o['CaseOwner'] = $this->CaseOwner;
if (isset($this->CaseStatus)) $o['CaseStatus'] = JsonConverters::to('SupportCaseStatusResponse', $this->CaseStatus);
if (isset($this->CaseType)) $o['CaseType'] = JsonConverters::to('SupportCaseTypeResponse', $this->CaseType);
if (isset($this->CaseArea)) $o['CaseArea'] = JsonConverters::to('SupportCaseAreaResponse', $this->CaseArea);
if (isset($this->Comments)) $o['Comments'] = JsonConverters::toArray('SupportCaseCommentsResponse', $this->Comments);
if (isset($this->Attachments)) $o['Attachments'] = JsonConverters::toArray('SupportCaseAttachmentResponse', $this->Attachments);
if (isset($this->CaseStatusOptions)) $o['CaseStatusOptions'] = JsonConverters::toArray('SupportCaseStatusResponse', $this->CaseStatusOptions);
if (isset($this->CaseTypeOptions)) $o['CaseTypeOptions'] = JsonConverters::toArray('SupportCaseTypeResponse', $this->CaseTypeOptions);
if (isset($this->CaseAreaOptions)) $o['CaseAreaOptions'] = JsonConverters::toArray('SupportCaseAreaResponse', $this->CaseAreaOptions);
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateSupportCase implements ICompany, JsonSerializable
{
public function __construct(
/** @description Enter the company id, if blank company id and you are an admin, your company id will be used. */
// @ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
/** @var string */
public string $CompanyId='',
/** @description The case title. */
// @ApiMember(Description="The case title.")
/** @var string|null */
public ?string $Title=null,
/** @description The case description. */
// @ApiMember(Description="The case description.")
/** @var string|null */
public ?string $Description=null,
/** @description If the case type id. */
// @ApiMember(Description="If the case type id.")
/** @var int */
public int $CaseTypeId=0,
/** @description If the case area id. */
// @ApiMember(Description="If the case area id.")
/** @var int */
public int $CaseAreaId=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['Title'])) $this->Title = $o['Title'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['CaseTypeId'])) $this->CaseTypeId = $o['CaseTypeId'];
if (isset($o['CaseAreaId'])) $this->CaseAreaId = $o['CaseAreaId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->Title)) $o['Title'] = $this->Title;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->CaseTypeId)) $o['CaseTypeId'] = $this->CaseTypeId;
if (isset($this->CaseAreaId)) $o['CaseAreaId'] = $this->CaseAreaId;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /support/cases HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateSupportCase xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<CaseAreaId>0</CaseAreaId>
<CaseTypeId>0</CaseTypeId>
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<Description>String</Description>
<Title>String</Title>
</CreateSupportCase>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <SupportCaseQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <Attachments> <SupportCaseAttachmentResponse> <FileUrl>String</FileUrl> <Id>0</Id> </SupportCaseAttachmentResponse> </Attachments> <CaseArea> <Description>String</Description> <Id>0</Id> <Name>String</Name> </CaseArea> <CaseAreaId>0</CaseAreaId> <CaseAreaOptions> <SupportCaseAreaResponse> <Description>String</Description> <Id>0</Id> <Name>String</Name> </SupportCaseAreaResponse> </CaseAreaOptions> <CaseOwner>String</CaseOwner> <CaseStatus> <Color>String</Color> <Description>String</Description> <Icon>String</Icon> <Id>0</Id> <Name>String</Name> </CaseStatus> <CaseStatusId>0</CaseStatusId> <CaseStatusOptions> <SupportCaseStatusResponse> <Color>String</Color> <Description>String</Description> <Icon>String</Icon> <Id>0</Id> <Name>String</Name> </SupportCaseStatusResponse> </CaseStatusOptions> <CaseType> <Description>String</Description> <Id>0</Id> <Name>String</Name> </CaseType> <CaseTypeId>0</CaseTypeId> <CaseTypeOptions> <SupportCaseTypeResponse> <Description>String</Description> <Id>0</Id> <Name>String</Name> </SupportCaseTypeResponse> </CaseTypeOptions> <Comments> <SupportCaseCommentsResponse> <Comment>String</Comment> <Created>0001-01-01T00:00:00</Created> <CreatedBy>String</CreatedBy> <Id>0</Id> <SupportCaseId>0</SupportCaseId> </SupportCaseCommentsResponse> </Comments> <CompanyUserId>00000000-0000-0000-0000-000000000000</CompanyUserId> <Created>0001-01-01T00:00:00</Created> <CreatedBy>String</CreatedBy> <Description>String</Description> <Id>0</Id> <SolvedBy>String</SolvedBy> <Title>String</Title> <Updated>0001-01-01T00:00:00</Updated> <UpdatedBy>String</UpdatedBy> </SupportCaseQueryResponse>