Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
GET | /webhook/messages | List webhook message |
---|
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 ClientWebhookRequestBase:
client_id: Optional[str] = None
class Ordering(IntEnum):
ASCENDING = 'ascending'
DESCENDING = 'descending'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ListMessagesRequestDto(ClientWebhookRequestBase):
before: Optional[datetime.datetime] = None
after: Optional[datetime.datetime] = None
channel: Optional[str] = None
iterator: Optional[str] = None
limit: Optional[int] = None
order: Optional[Ordering] = None
event_types: Optional[List[str]] = None
with_content: Optional[bool] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ListMessagesResponseDto:
data: Optional[List[GetMessageResponseDto]] = None
done: bool = False
iterator: Optional[str] = None
# @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
# @ValidateRequest(Validator="IsAuthenticated")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ListWebhookMessages(ListMessagesRequestDto, ICompany):
# @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.", IsRequired=true, ParameterType="query")
company_id: Optional[str] = None
"""
The company id, if empty will use the company id for the user you are logged in with.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetMessageResponseDto:
id: Optional[str] = None
channels: Optional[List[str]] = None
event_type: Optional[str] = None
metadata: Optional[Dict[str, str]] = None
payload: Optional[Object] = None
event_id: Optional[str] = None
timestamp: datetime.datetime = datetime.datetime(1, 1, 1)
Python ListWebhookMessages 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.
GET /webhook/messages HTTP/1.1 Host: api.bokamera.se Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"Data":[{"Id":"String","Channels":["String"],"EventType":"String","Metadata":{"String":"String"},"Payload":{},"EventId":"String"}],"Done":false,"Iterator":"String"}