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

Add event to allow inspecting and changing multipart responses #1074

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

icewind1991
Copy link
Contributor

Use case for this is allowing caching/pagination of multipart responses.

@codecov
Copy link

codecov bot commented Nov 27, 2018

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.24%. Comparing base (97129a9) to head (a9fe8fc).
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1074      +/-   ##
============================================
+ Coverage     97.22%   97.24%   +0.01%     
  Complexity     2834     2834              
============================================
  Files           175      175              
  Lines          9018     8843     -175     
============================================
- Hits           8768     8599     -169     
+ Misses          250      244       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@icewind1991 icewind1991 force-pushed the multistatus-hook branch 2 times, most recently from e5366d0 to 01b428a Compare November 27, 2018 14:00
@DeepDiver1975
Copy link
Member

@icewind1991 Can I ask you for an example code snippet on how this event can be used?

I'm missing some logic which tells the code on what to do after the event was take care of or not.

THX

@icewind1991
Copy link
Contributor Author

My current use case for this is here: https://github.com/nextcloud/server/pull/10880/files#diff-a8ef54ad5b45404480feafc1de1eea28R62 where it stores a copy of the mutlipart listing result and limits the output returned.

@DeepDiver1975
Copy link
Member

My current use case for this is here: https://github.com/nextcloud/server/pull/10880/files#diff-a8ef54ad5b45404480feafc1de1eea28R62 where it stores a copy of the mutlipart listing result and limits the output returned.

I see you are using it for caching the dataset for later reuse - got it.

Why are you passing the properties by ref then?

@icewind1991
Copy link
Contributor Author

Because it also overwrites the returned properties to limit the number of results returned in the response.

@DeepDiver1975
Copy link
Member

Got it - THX

I was having trouble in the past as well with the missing capabilities to change the behavior of generateMultiStatus

What about a more generic approach where the whole method can be overwritten?

like emitting a generateMultiStatus event and in case not handled we fall back to the default implementation.

My use case was to chnage the content type from xml to json ...

@staabm what's our point on this? THX

@icewind1991
Copy link
Contributor Author

The ability to overwrite the method would also work yes, this was just the minimal approach I found

@DeepDiver1975
Copy link
Member

@icewind1991 how do we continue with this one?

@icewind1991
Copy link
Contributor Author

Rebased.

I would still like to have this merged as I believe that it provides a useful option for plugin authors at minimal cost.

@staabm staabm requested a review from phil-davis April 29, 2024 16:25
Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

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

LGTM

I will have a look through other pending sabre repo PRs over the next day or so, and probably make some releases "soon".

@phil-davis phil-davis merged commit 4c4cf77 into sabre-io:master Apr 30, 2024
9 checks passed
@phil-davis
Copy link
Contributor

Ported to the major version 4 release series in PR #1549

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

Successfully merging this pull request may close these issues.

4 participants