Add new resources, part 7/7.

Review Request #14380 — Created March 20, 2025 and updated

Information

RBTools
master

Reviewers

This change adds the following new resource implementations:
- ArchivedReviewRequestItemResource
- ArchivedReviewRequestListResource
- MutedReviewRequestItemResource
- MutedReviewRequestListResource

These resources are special because they do not support GET operations,
and the regular links introspection therefore doesn't work. The
implementation of these is therefore done as a custom layer that allows
us to get a "bare" instance of the resource, which can then be used for
create or delete as appropriate.

  • Ran unit tests.
  • Used the new resources from a test script and saw that everything
    worked as expected.
Summary ID
Add new resources, part 7/7.
This change adds the following new resource implementations: - ArchivedReviewRequestItemResource - ArchivedReviewRequestListResource - MutedReviewRequestItemResource - MutedReviewRequestListResource These resources are special because they do not support GET operations, and the regular links introspection therefore doesn't work. The implementation of these is therefore done as a custom layer that allows us to get a "bare" instance of the resource, which can then be used for `create` or `delete` as appropriate. Testing Done: - Ran unit tests. - Used the new resources from a test script and saw that everything worked as expected.
1f3be896d12e52ad681b0597efe89d9ad47d3e2b
Description From Last Updated

Missing period.

chipx86chipx86

LINKS_TOK sorts before ListResource.

chipx86chipx86

I can't remember if the base class has been updated for keyword-onlyness. If so, we should fix that here and …

chipx86chipx86

But it would be nice (here and below) to call as keyword arguments to be explicit.

chipx86chipx86

Should be updated for the full module path.

chipx86chipx86

Here, too.

chipx86chipx86

"URI template"?

chipx86chipx86

Each of these code samples should have double backticks around them.

chipx86chipx86

"url" -> "URL".

chipx86chipx86

Any way we can avoid repeating all this, given the complexity?

chipx86chipx86

These aren't unused, they get passed to the parent __init__.

maubinmaubin

Here and below say "Xeyword" now :p

maubinmaubin

Same here.

maubinmaubin

Should be MutedReviewRequestItemResource and say "item resource" here.

maubinmaubin

Add a "Version Added" for this.

maubinmaubin

Copy-paste-o referring to API token?

maubinmaubin

Should be ArchivedReviewRequestItemResource

maubinmaubin

Copy-paste-o referring to API token? Same below

maubinmaubin

Should say MutedReviewRequestItemResource

maubinmaubin
There are no open issues
chipx86
  1. 
      
  2. Show all issues

    Missing period.

  3. rbtools/api/resource/base_archived_object.py (Diff revision 1)
     
     
     
     
    Show all issues

    LINKS_TOK sorts before ListResource.

  4. rbtools/api/resource/base_archived_object.py (Diff revision 1)
     
     
     
     
    Show all issues

    I can't remember if the base class has been updated for keyword-onlyness. If so, we should fix that here and below. If not, ignore this.

  5. Show all issues

    But it would be nice (here and below) to call as keyword arguments to be explicit.

  6. rbtools/api/resource/root.py (Diff revision 1)
     
     
    Show all issues

    Should be updated for the full module path.

  7. rbtools/api/resource/root.py (Diff revision 1)
     
     
    Show all issues

    Here, too.

  8. rbtools/api/resource/root.py (Diff revision 1)
     
     
    Show all issues

    "URI template"?

  9. rbtools/api/resource/root.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    Each of these code samples should have double backticks around them.

  10. rbtools/api/resource/root.py (Diff revision 1)
     
     
    Show all issues

    "url" -> "URL".

  11. rbtools/api/resource/root.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Any way we can avoid repeating all this, given the complexity?

    1. I don't know that splitting the cast/make_url_from_template stuff out into a separate method really reduces the number of lines in any measurable way.

  12. 
      
david
maubin
  1. 
      
  2. Show all issues

    These aren't unused, they get passed to the parent __init__.

  3. Show all issues

    Same here.

  4. Show all issues

    Should be MutedReviewRequestItemResource and say "item resource" here.

  5. rbtools/api/resource/root.py (Diff revision 2)
     
     
    Show all issues

    Add a "Version Added" for this.

  6. rbtools/api/resource/root.py (Diff revision 2)
     
     
    Show all issues

    Copy-paste-o referring to API token?

  7. rbtools/api/resource/root.py (Diff revision 2)
     
     
    Show all issues

    Should be ArchivedReviewRequestItemResource

  8. rbtools/api/resource/root.py (Diff revision 2)
     
     
    Show all issues

    Copy-paste-o referring to API token? Same below

  9. rbtools/api/resource/root.py (Diff revision 2)
     
     
    Show all issues

    Should say MutedReviewRequestItemResource

  10. 
      
david
maubin
  1. 
      
  2. rbtools/api/resource/base_archived_object.py (Diff revisions 2 - 3)
     
     
    Show all issues

    Here and below say "Xeyword" now :p

  3. 
      
david
Review request changed
Commits:
Summary ID
Add new resources, part 7/7.
This change adds the following new resource implementations: - ArchivedReviewRequestItemResource - ArchivedReviewRequestListResource - MutedReviewRequestItemResource - MutedReviewRequestListResource These resources are special because they do not support GET operations, and the regular links introspection therefore doesn't work. The implementation of these is therefore done as a custom layer that allows us to get a "bare" instance of the resource, which can then be used for `create` or `delete` as appropriate. Testing Done: - Ran unit tests. - Used the new resources from a test script and saw that everything worked as expected.
085d5a97a4ee53d355630f5a41447337d46499d1
Add new resources, part 7/7.
This change adds the following new resource implementations: - ArchivedReviewRequestItemResource - ArchivedReviewRequestListResource - MutedReviewRequestItemResource - MutedReviewRequestListResource These resources are special because they do not support GET operations, and the regular links introspection therefore doesn't work. The implementation of these is therefore done as a custom layer that allows us to get a "bare" instance of the resource, which can then be used for `create` or `delete` as appropriate. Testing Done: - Ran unit tests. - Used the new resources from a test script and saw that everything worked as expected.
1f3be896d12e52ad681b0597efe89d9ad47d3e2b
Diff:

Revision 4 (+1218 -30)

Show changes

rbtools/api/resource/__init__.py
rbtools/api/resource/archived_review_request.py
rbtools/api/resource/base_archived_object.py
rbtools/api/resource/muted_review_request.py
rbtools/api/resource/root.py
rbtools/api/resource/user.py

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
maubin
  1. Ship It!
  2. 
      
Loading...