Skip to content
Snippets Groups Projects
Commit f0ead1c5 authored by Fernando Takagi's avatar Fernando Takagi
Browse files

Add to api client

parent df30ba73
Branches
No related tags found
No related merge requests found
...@@ -1319,6 +1319,14 @@ ...@@ -1319,6 +1319,14 @@
"in": "query", "in": "query",
"required": false, "required": false,
"type": "string" "type": "string"
},
{
"name": "instant",
"description": "Time which around to list messages in seconds (since epoch), if any. Used only if no cursor is provided.",
"in": "query",
"required": false,
"type": "string",
"format": "int64"
} }
], ],
"tags": [ "tags": [
......
...@@ -68,12 +68,17 @@ func (s *ApiServer) ListChannelMessages(ctx context.Context, in *api.ListChannel ...@@ -68,12 +68,17 @@ func (s *ApiServer) ListChannelMessages(ctx context.Context, in *api.ListChannel
forward = in.GetForward().Value forward = in.GetForward().Value
} }
var instant int64
if in.GetInstant() != nil {
instant = in.GetInstant().Value
}
streamConversionResult, err := ChannelIdToStream(in.ChannelId) streamConversionResult, err := ChannelIdToStream(in.ChannelId)
if err != nil { if err != nil {
return nil, status.Error(codes.InvalidArgument, "Invalid channel ID.") return nil, status.Error(codes.InvalidArgument, "Invalid channel ID.")
} }
messageList, err := ChannelMessagesList(ctx, s.logger, s.db, userID, streamConversionResult.Stream, in.ChannelId, limit, forward, in.Cursor, nil) messageList, err := ChannelMessagesList(ctx, s.logger, s.db, userID, streamConversionResult.Stream, in.ChannelId, limit, forward, in.Cursor, instant)
if err == runtime.ErrChannelCursorInvalid { if err == runtime.ErrChannelCursorInvalid {
return nil, status.Error(codes.InvalidArgument, "Cursor is invalid or expired.") return nil, status.Error(codes.InvalidArgument, "Cursor is invalid or expired.")
} else if err == runtime.ErrChannelGroupNotFound { } else if err == runtime.ErrChannelGroupNotFound {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment