Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting field in GetMessageMetadata #117

Closed
jarmani opened this issue Oct 25, 2023 · 2 comments
Closed

Sorting field in GetMessageMetadata #117

jarmani opened this issue Oct 25, 2023 · 2 comments

Comments

@jarmani
Copy link

jarmani commented Oct 25, 2023

Hi,

In commit ca6c1de sorting order was added, but it is still impossible to sort by anything other than the ID.

Would it be acceptable to also add the Sort field ?

Quick proof of concept :

index 629bdbd..56c2a96 100644
--- a/message.go
+++ b/message.go
@@ -246,15 +246,16 @@ func (c *Client) GetMessageMetadataPage(ctx context.Context, page, pageSize int,
 
 		Page     int
 		PageSize int
-
-		Sort string
 	}{
 		MessageFilter: filter,
 
 		Page:     page,
 		PageSize: pageSize,
+	}
 
-		Sort: "ID",
+	/* keep default sort to maintain backward compatibility */
+	if req.Sort == "" {
+		req.Sort = "ID"
 	}
 
 	for {
diff --git a/message_types.go b/message_types.go
index 4d5fe95..a6ef6d9 100644
--- a/message_types.go
+++ b/message_types.go
@@ -55,6 +55,7 @@ type MessageFilter struct {
 	ExternalID string `json:",omitempty"`
 	LabelID    string `json:",omitempty"`
 	EndID      string `json:",omitempty"`
+	Sort       string `json:",omitempty"`
 	Desc       Bool
 }

Thanks !

@jarmani
Copy link
Author

jarmani commented Nov 3, 2023

Hi,

Any thoughts on this ?

@jarmani
Copy link
Author

jarmani commented Nov 18, 2023

Move to #122

@jarmani jarmani closed this as completed Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant