Skip to content

Commit

Permalink
API-13718 agent-api: add chats in get_customer response v3.4 (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
wfabjanczuk authored Aug 21, 2024
1 parent 5aaee9c commit 32061f1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions agent/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type userSpecific struct {
EmailVerified json.RawMessage `json:"email_verified"`
CreatedAt json.RawMessage `json:"created_at"`
Visibility json.RawMessage `json:"visibility"`
Chats json.RawMessage `json:"chats"`
}

// Agent function converts User object to Agent object if User's Type is "agent".
Expand Down Expand Up @@ -148,6 +149,9 @@ func (u *User) Customer() *Customer {
if err := json.Unmarshal(u.GroupIDs, &c.GroupIDs); err != nil {
return nil
}
if err := internal.UnmarshalOptionalRawField(u.Chats, &c.Chats); err != nil {
return nil
}
return &c
}

Expand Down Expand Up @@ -291,6 +295,14 @@ type Customer struct {
Online bool `json:"online"`
State string `json:"state"`
GroupIDs []int `json:"group_ids"`
Chats []*CustomerChat `json:"chats,omitempty"`
}

// CustomerChat represents LiveChat customer's chat
type CustomerChat struct {
ChatID string `json:"chat_id"`
ThreadID string `json:"thread_id,omitempty"`
LastThreadStartedAt time.Time `json:"last_thread_started_at"`
}

// Queue represents position of a thread in a queue
Expand Down

0 comments on commit 32061f1

Please sign in to comment.