Requires any of the roles: | bookingsupplier-administrator-write, bookingsupplier-administrator-read, superadmin |
GET | /companies/{CompanyId}/incentives | It gets either incentives which are not read or engaged by the current company/administrator. |
---|
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 BaseModel:
pass
class IncentiveActionType(IntEnum):
UPGRADE = 1
ADD_ON = 2
INFORMATION = 3
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class IncentiveAction(BaseModel):
id: int = 0
action_type: Optional[IncentiveActionType] = None
page: Optional[str] = None
segment: Optional[str] = None
element: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CompanyIncentiveResponse:
id: int = 0
heading: Optional[str] = None
storage_url: Optional[str] = None
success_button_text: Optional[str] = None
action_id: int = 0
initial_delay_in_seconds: int = 0
max_display_count: Optional[int] = None
valid_from: datetime.datetime = datetime.datetime(1, 1, 1)
valid_to: datetime.datetime = datetime.datetime(1, 1, 1)
action: Optional[IncentiveAction] = None
payload: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CompanyIncentivesQueryResponse:
incentives: Optional[IList[CompanyIncentiveResponse]] = None
company_id: Optional[str] = None
# @ValidateRequest(Validator="IsAuthenticated")
# @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CompanyIncentiveQuery(ICompany):
# @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.", IsRequired=true, ParameterType="path")
company_id: Optional[str] = None
"""
The company id, if empty will use the company id for the user you are logged in with.
"""
Python CompanyIncentiveQuery DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /companies/{CompanyId}/incentives HTTP/1.1 Host: testapi.bokamera.se Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { }