Update March 11, 2025 (#154)
This commit is contained in:
@@ -164,6 +164,8 @@ type ChatHistoryParams struct {
|
||||
// The default value is `Backward`. You can set the number of messages in the limit parameter
|
||||
Direction string `json:"direction" default:"Backward"`
|
||||
|
||||
Filter *ChatHistoryFilter `json:"filter,omitempty"`
|
||||
|
||||
// Identifier of the message from which the chat history will be displayed.
|
||||
// Default value is the last visible message
|
||||
FromMessageId string `json:"from_message_id"`
|
||||
@@ -172,6 +174,10 @@ type ChatHistoryParams struct {
|
||||
Limit int64 `json:"limit" default:"50"`
|
||||
}
|
||||
|
||||
type ChatHistoryFilter struct {
|
||||
MessageIds []string `json:"message_ids"`
|
||||
}
|
||||
|
||||
type ChatHistoryResponse struct {
|
||||
core.CommonResponse
|
||||
|
||||
@@ -183,22 +189,33 @@ type ChatHistoryResponse struct {
|
||||
}
|
||||
|
||||
type ChatHistoryMessage struct {
|
||||
Context *ChatHistoryContext `json:"context,omitempty"`
|
||||
|
||||
// Message creation date
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
// Array with message content in Markdown format
|
||||
Data []string `json:"data"`
|
||||
|
||||
IsImage bool `json:"is_image"`
|
||||
|
||||
// Indication of the read message
|
||||
IsRead bool `json:"is_read"`
|
||||
|
||||
// Message identifier
|
||||
MessageId string `json:"message_id"`
|
||||
|
||||
ModarateImageStatus string `json:"moderate_image_status"`
|
||||
|
||||
// Chat participant identifier
|
||||
User ChatHistoryMessageUser `json:"user"`
|
||||
}
|
||||
|
||||
type ChatHistoryContext struct {
|
||||
OrderNumber string `json:"order_number"`
|
||||
SKU string `json:"sku"`
|
||||
}
|
||||
|
||||
type ChatHistoryMessageUser struct {
|
||||
// Chat participant identifier
|
||||
Id string `json:"id"`
|
||||
@@ -214,7 +231,7 @@ type ChatHistoryMessageUser struct {
|
||||
|
||||
// Returns the history of chat messages. By default messages are shown from newest to oldest.
|
||||
func (c Chats) History(ctx context.Context, params *ChatHistoryParams) (*ChatHistoryResponse, error) {
|
||||
url := "/v2/chat/history"
|
||||
url := "/v3/chat/history"
|
||||
|
||||
resp := &ChatHistoryResponse{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user