• 
      

    Add new resources, part 7/7.

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

    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.
    b0232de2c0c5b4a4f5fd141ce1e6a3b50b6c0c04
    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

    Missing a trailing period.

    chipx86chipx86

    Python 3.9 is the minimum, right? I forget. If not, we have to adjust this.

    chipx86chipx86

    Can we put these in alphabetical order?

    chipx86chipx86

    Missing a trailing period.

    chipx86chipx86

    Can we sort these?

    chipx86chipx86
    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
    maubin
    1. Ship It!
    2. 
        
    chipx86
    1. 
        
    2. Show all issues

      Missing a trailing period.

    3. rbtools/api/resource/root.py (Diff revision 4)
       
       
      Show all issues

      Python 3.9 is the minimum, right? I forget. If not, we have to adjust this.

      1. Yeah, I think for all major releases from now on it's 3.9+. Point releases may still be 3.8, of course.

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

      Can we put these in alphabetical order?

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

      Missing a trailing period.

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

      Can we sort these?

    7. 
        
    david
    maubin
    1. Ship It!
    2. 
        
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (19ebba2)