Cli-microsoft365: Teams Message List could use delta endpoint

Created on 26 Sep 2019  路  12Comments  路  Source: pnp/cli-microsoft365

It looks like this command could use the delta endpoint, allowing for an optional filter to get only messages (or updated messages) since a specific datetime: chatMessages: delta.

If you don't specify a filter, it will just get all messages (without replies) as per the normal /messages endpoint. As the filter param is optional, we should be able to switch the underlying endpoint for the existing command without breaking anybody... thoughts?

enhancement work in progress

Most helpful comment

Sorry for the delay on this. Should be able to finally get to it next week.

All 12 comments

Can we not have that as separate command ? @waldekmastykarz

The obvious thing is to make it a new command. I only suggested incorporating it into the main command because a separate one seems redundant. There might be an imperative to match the REST endpoints one-to-one that I'm not aware of, of course. Also, if the beta API diverges for these two, then you might have a problem.

I'd actually opt for an additional option as @balbany suggested. So we'd have something like --since [since] and when specified, it would retrieve messages using the delta endpoint. Before we implement it in the same command, we'd need to verify that the schema of the returned data is the same. Otherwise it would be confusing if the same command returned two types of data depending on the specified argument.

You can give this one to me - I should be able to get to it before the end of the month.

All yours @balbany thank you for your help 馃憤馃徎

Sorry for the delay on this. Should be able to finally get to it next week.

No problem, thanks for the update @balbany 馃憤馃徎

Hey @balbany, are you still working on this?

Hey @waldekmastykarz, apologies on the delay. Should have a PR for you in the next day or so.

Ooh. A new constraint:

Note: Delta will only return messages within the last eight months. You can use GET /teams/{id}/channels/{id}/messages to retrieve older messages.

How do we want to deal with requests asking for --since a date prior to this? Throw an error, or show a warning that only messages from the last 8 months will be returned? @waldekmastykarz

Appreciate your help @balbany.

It would be good to catch it in the command validation routine, so when you specify that you want to use delta and the passed since date is before 8 months ago, validation should fail with a clear error message. Does this make sense?

Yep, thanks for that. Will let you know if I get stuck.

Was this page helpful?
0 / 5 - 0 ratings