Skip to content

Commit

Permalink
[WTEL-3534]: added paging on contacts timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehor Datsenko committed May 9, 2024
1 parent 8e70ac6 commit 8a9b641
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 246 deletions.
235 changes: 18 additions & 217 deletions swagger/contacts.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2167,36 +2167,20 @@
]
},
"collectionFormat": "multi"
}
],
"tags": [
"Timeline"
]
}
},
"/contacts/{contact_id}/timeline/chats/{conversation_id}": {
"get": {
"operationId": "Timeline_GetDetailedMessageHistory",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/webitel.chat.ChatMessages"
}
}
},
"parameters": [
},
{
"name": "contact_id",
"in": "path",
"required": true,
"type": "string"
"name": "page",
"in": "query",
"required": false,
"type": "string",
"format": "int64"
},
{
"name": "conversation_id",
"in": "path",
"required": true,
"type": "string"
"name": "size",
"in": "query",
"required": false,
"type": "string",
"format": "int64"
}
],
"tags": [
Expand Down Expand Up @@ -3308,196 +3292,6 @@
"default": "NULL_VALUE",
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
},
"webitel.chat.Chat": {
"type": "object",
"properties": {
"dc": {
"type": "string",
"format": "int64",
"description": "[D]omain[C]omponent primary ID."
},
"id": {
"type": "string",
"description": "Unique identifier for this chat.\n[FROM] Member / Channel ID.\n\n// [TO] Group. Conversation ID.\n string chat_id = 2;"
},
"via": {
"$ref": "#/definitions/webitel.chat.Peer",
"description": "[FROM] VIA text gateway profile."
},
"peer": {
"$ref": "#/definitions/webitel.chat.Peer",
"description": "[FROM]: User identity. Seed."
},
"title": {
"type": "string",
"description": "[TO]: Chat title."
},
"left": {
"type": "string",
"format": "int64",
"title": "OPTIONAL. A non-zero value indicates that\nthe participant has left the chat. OFFLINE(!)"
},
"join": {
"type": "string",
"format": "int64",
"description": "OPTIONAL. A non-zero value indicates that\nthe participant has joined the chat."
},
"invite": {
"$ref": "#/definitions/webitel.chat.Chat.Invite",
"description": "OPTIONAL. Invite[d] BY member info."
},
"context": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Context. Variables."
}
},
"description": "The Chat info.\nAlias: participant, subscriber, member, peer, leg."
},
"webitel.chat.Chat.Invite": {
"type": "object",
"properties": {
"date": {
"type": "string",
"format": "int64",
"title": "Timestamp when the invitation to join the chat was sent"
},
"from": {
"type": "string",
"title": "Chat member ID who invited to join the chat"
}
}
},
"webitel.chat.ChatMessages": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/webitel.chat.Message"
},
"description": "Dataset page of messages."
},
"chats": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/webitel.chat.Chat"
},
"title": "List of chats mentioned in messages. [FROM]"
},
"peers": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/webitel.chat.Peer"
},
"title": "List of peers mentioned in messages. [FROM]"
},
"page": {
"type": "integer",
"format": "int32",
"description": "Dataset page number."
},
"next": {
"type": "boolean",
"title": "Next page is available ?"
}
},
"title": "ChatMessages dataset"
},
"webitel.chat.File": {
"type": "object",
"properties": {
"id": {
"type": "string",
"title": "File location"
},
"size": {
"type": "string",
"format": "int64",
"title": "Size in bytes"
},
"type": {
"type": "string",
"title": "MIME media type"
},
"name": {
"type": "string",
"title": "Filename"
}
},
"description": "Media File."
},
"webitel.chat.Message": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "int64",
"description": "Unique message identifier inside this chat."
},
"date": {
"type": "string",
"format": "int64",
"description": "Timestamp when this message was sent (published)."
},
"from": {
"$ref": "#/definitions/webitel.chat.Peer",
"description": "Sender of the message."
},
"chat": {
"$ref": "#/definitions/webitel.chat.Chat",
"description": "Conversation the message belongs to .."
},
"sender": {
"$ref": "#/definitions/webitel.chat.Chat",
"description": "Chat Sender of the message, sent on behalf of a chat (member)."
},
"edit": {
"type": "string",
"format": "int64",
"description": "Timestamp when this message was last edited."
},
"text": {
"type": "string",
"description": "Message Text."
},
"file": {
"$ref": "#/definitions/webitel.chat.File",
"description": "Message Media. Attachment."
},
"context": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Context. Variables. Environment."
}
},
"description": "Chat Message."
},
"webitel.chat.Peer": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Contact unique **ID**entifier.\nContact **type**-specific string."
},
"type": {
"type": "string",
"description": "Contact **type** provider."
},
"name": {
"type": "string",
"description": "Contact display **name**."
}
},
"description": "Peer contact."
},
"webitel.contacts.AccessMode": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -3928,6 +3722,13 @@
"type": "object",
"$ref": "#/definitions/webitel.contacts.DayTimeline"
}
},
"page": {
"type": "string",
"format": "int64"
},
"next": {
"type": "boolean"
}
}
},
Expand Down
43 changes: 14 additions & 29 deletions webitel-go/contacts/timeline.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,14 @@ option go_package = "webitel.go/api/contacts;contacts";

import "google/api/annotations.proto";
import "contacts/fields.proto";
import "messages/history.proto";
import "chat/messages/history.proto";

service Timeline {
rpc GetTimeline(GetTimelineRequest) returns (GetTimelineResponse) {
option (google.api.http) = {
get: "/contacts/{contact_id}/timeline"
};
}
//
rpc GetDetailedMessageHistory(GetDetailedMessageHistoryRequest) returns (chat.ChatMessages) {
option (google.api.http) = {
get: "/contacts/{contact_id}/timeline/chats/{conversation_id}"
};
}
//
// rpc GetDetailedCallHistory(GetDetailedCallHistoryRequest) returns (GetDetailedCallHistoryResponse) {
// option (google.api.http) = {
// get: "/contacts/{contact_id}/timeline/calls/{call_id}"
// body: "input"
// };
// }
}


Expand All @@ -35,31 +22,29 @@ message GetTimelineRequest {
int64 date_from = 2;
int64 date_to = 3;
repeated TimelineEventType type = 4;
}

message GetDetailedMessageHistoryRequest {
string conversation_id = 1;
string contact_id = 2;
}


message GetDetailedCallHistoryRequest {
string call_id = 1;
int64 page = 5;
int64 size = 6;
}


message GetDetailedMessageHistoryResponse {

message GetTimelineResponse {
repeated DayTimeline days = 2;
int64 page = 3;
bool next = 4;
}


message GetDetailedCallHistoryResponse {

message GetTimelineCounterRequest {
string contact_id = 1;
}

message GetTimelineCounterResponse {
int64 date_from = 1;
int64 date_to = 2;
int64 chats_count = 3;
int64 calls_count = 4;

message GetTimelineResponse {
repeated DayTimeline days = 2;
}

message TimelineRecord {
Expand Down

0 comments on commit 8a9b641

Please sign in to comment.