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

Feat/bb api helper functions #155

Merged
merged 3 commits into from
Jan 15, 2024
Merged

Conversation

cnuss
Copy link
Collaborator

@cnuss cnuss commented Jan 15, 2024

Add helper functions to build the URL and make GetChatsWithMessagesAfter work in a very light fashion

@cnuss cnuss requested a review from tulir January 15, 2024 15:14
@cnuss cnuss changed the base branch from master to bluebubbles January 15, 2024 15:14
for _, chat := range *response.Data {
resp = append(resp, imessage.ChatIdentifier{
ChatGUID: fmt.Sprintf("%v", chat.GUID),
ThreadID: fmt.Sprintf("%v", chat.ChatIdentifier), // TODO Is this the right one to use?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thread ID field is for iMessage group IDs, which are usually uuids. Not sure if BlueBubbles exposes them anywhere, but it's fine to just omit the field

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, fmt.Sprintfing a string to get the same string seems kind of pointless

type ChatQueryResponse struct {
Status int64 `json:"status"`
Message string `json:"message"`
Data *[]Chat `json:"data"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably doesn't need to be a pointer, slices are nillable on their own

Comment on lines 320 to 323
"lastMessage",
"sms",
},
Sort: "lastmessage",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These would probably be good to extract into constants

@cnuss cnuss requested a review from tulir January 15, 2024 15:28
@cnuss cnuss merged commit e65e5ed into bluebubbles Jan 15, 2024
11 checks passed
@cnuss cnuss deleted the feat/bb-api-helper-functions branch January 15, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants