Requires the role: | superadmin |
POST | /superadmin/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. |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseStatusResponse:
# @ApiMember(Description="The status id")
id: int = 0
"""
The status id
"""
# @ApiMember(Description="The status name")
name: Optional[str] = None
"""
The status name
"""
# @ApiMember(Description="The status description")
description: Optional[str] = None
"""
The status description
"""
# @ApiMember(Description="The status icon")
icon: Optional[str] = None
"""
The status icon
"""
# @ApiMember(Description="The status color")
color: Optional[str] = None
"""
The status color
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseTypeResponse:
# @ApiMember(Description="The type id")
id: int = 0
"""
The type id
"""
# @ApiMember(Description="The type name")
name: Optional[str] = None
"""
The type name
"""
# @ApiMember(Description="The type description")
description: Optional[str] = None
"""
The type description
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseAreaResponse:
# @ApiMember(Description="The area id")
id: int = 0
"""
The area id
"""
# @ApiMember(Description="The area name")
name: Optional[str] = None
"""
The area name
"""
# @ApiMember(Description="The area description")
description: Optional[str] = None
"""
The area description
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseCommentsResponse:
# @ApiMember(Description="The case id")
support_case_id: int = 0
"""
The case id
"""
# @ApiMember(Description="The comments id")
id: int = 0
"""
The comments id
"""
# @ApiMember(Description="The case comment")
comment: Optional[str] = None
"""
The case comment
"""
# @ApiMember(Description="The case comment created by")
created_by: Optional[str] = None
"""
The case comment created by
"""
# @ApiMember(Description="The case comment created date")
created: datetime.datetime = datetime.datetime(1, 1, 1)
"""
The case comment created date
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseAttachmentResponse:
# @ApiMember(Description="The attachment id")
id: int = 0
"""
The attachment id
"""
# @ApiMember(Description="The attachment file url")
file_url: Optional[str] = None
"""
The attachment file url
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseQueryResponse:
# @ApiMember(Description="The support case id")
id: int = 0
"""
The support case id
"""
# @ApiMember(Description="The company user id")
company_user_id: Optional[str] = None
"""
The company user id
"""
# @ApiMember(Description="The case title.")
title: Optional[str] = None
"""
The case title.
"""
# @ApiMember(Description="The case description.")
description: Optional[str] = None
"""
The case description.
"""
# @ApiMember(Description="The case status id.")
case_status_id: int = 0
"""
The case status id.
"""
# @ApiMember(Description="If the case type id.")
case_type_id: int = 0
"""
If the case type id.
"""
# @ApiMember(Description="If the case area id.")
case_area_id: int = 0
"""
If the case area id.
"""
# @ApiMember(Description="The case created by.")
created_by: Optional[str] = None
"""
The case created by.
"""
# @ApiMember(Description="The case updated by.")
updated_by: Optional[str] = None
"""
The case updated by.
"""
# @ApiMember(Description="The case solved by.")
solved_by: Optional[str] = None
"""
The case solved by.
"""
# @ApiMember(Description="If case updated date.")
updated: datetime.datetime = datetime.datetime(1, 1, 1)
"""
If case updated date.
"""
# @ApiMember(Description="If case created date.")
created: datetime.datetime = datetime.datetime(1, 1, 1)
"""
If case created date.
"""
# @ApiMember(Description="Who owns the support case.")
case_owner: Optional[str] = None
"""
Who owns the support case.
"""
# @ApiMember(Description="The case status information.")
case_status: Optional[SupportCaseStatusResponse] = None
"""
The case status information.
"""
# @ApiMember(Description="The case type information.")
case_type: Optional[SupportCaseTypeResponse] = None
"""
The case type information.
"""
# @ApiMember(Description="The case area information.")
case_area: Optional[SupportCaseAreaResponse] = None
"""
The case area information.
"""
# @ApiMember(Description="The case comments.")
comments: Optional[List[SupportCaseCommentsResponse]] = None
"""
The case comments.
"""
# @ApiMember(Description="The case attachments.")
attachments: Optional[List[SupportCaseAttachmentResponse]] = None
"""
The case attachments.
"""
# @ApiMember(Description="The case status options to select from.")
case_status_options: Optional[List[SupportCaseStatusResponse]] = None
"""
The case status options to select from.
"""
# @ApiMember(Description="The case type options to select from.")
case_type_options: Optional[List[SupportCaseTypeResponse]] = None
"""
The case type options to select from.
"""
# @ApiMember(Description="The case area options to select from.")
case_area_options: Optional[List[SupportCaseAreaResponse]] = None
"""
The case area options to select from.
"""
# @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")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SuperAdminCreateSupportCase(ICompany):
# @ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
company_id: Optional[str] = None
"""
Enter the company id, if blank company id and you are an admin, your company id will be used.
"""
# @ApiMember(Description="The case title.")
title: Optional[str] = None
"""
The case title.
"""
# @ApiMember(Description="The case description.")
description: Optional[str] = None
"""
The case description.
"""
# @ApiMember(Description="If the case type id.")
case_type_id: int = 0
"""
If the case type id.
"""
# @ApiMember(Description="If the case area id.")
case_area_id: int = 0
"""
If the case area id.
"""
Python SuperAdminCreateSupportCase DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /superadmin/support/cases HTTP/1.1
Host: api.bokamera.se
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Title":"String","Description":"String","CaseTypeId":0,"CaseAreaId":0}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"Id":0,"Title":"String","Description":"String","CaseStatusId":0,"CaseTypeId":0,"CaseAreaId":0,"CreatedBy":"String","UpdatedBy":"String","SolvedBy":"String","CaseOwner":"String","CaseStatus":{"Id":0,"Name":"String","Description":"String","Icon":"String","Color":"String"},"CaseType":{"Id":0,"Name":"String","Description":"String"},"CaseArea":{"Id":0,"Name":"String","Description":"String"},"Comments":[{"SupportCaseId":0,"Id":0,"Comment":"String","CreatedBy":"String"}],"Attachments":[{"Id":0,"FileUrl":"String"}],"CaseStatusOptions":[{"Id":0,"Name":"String","Description":"String","Icon":"String","Color":"String"}],"CaseTypeOptions":[{"Id":0,"Name":"String","Description":"String"}],"CaseAreaOptions":[{"Id":0,"Name":"String","Description":"String"}]}