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 Admin::Accounts methods #404

Merged
merged 6 commits into from
Dec 28, 2023

Conversation

PattaFeuFeu
Copy link
Collaborator

@PattaFeuFeu PattaFeuFeu commented Dec 26, 2023

Description

This PR implements the methods available via the Admin::Accounts endpoints. Despite the branch saying part-1, this actually implements all of them. After having started, I no longer even checked which ones were part of the ticket.

Warning

I have not implemented the v1 variant as it’s due for removal next year anyway.

Note

Mastodon API documentation examples still contain ip as an object instead of a String. I have decided to implement AdminAccount by how it’s defined in the Admin::Account documentation instead.

Closes #323, closes #324.

Type of Change

  • New feature
  • Documentation

Breaking Changes

  • None.

How Has This Been Tested?

New unit tests for all methods added including their optional parameter variants

Mandatory Checklist

  • I ran gradle check and there were no errors reported
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • I have added KDoc documentation to all public methods

Optional checks

  • In case you worked on a new feature: Did you also implement the reactive endpoint (bigbone-rx)?
  • In case you added new *Methods classes: Did you also reference it in the MastodonClient main class?
  • Did you also update the documentation in the /docs folder (e.g. API Coverage page)?

@PattaFeuFeu PattaFeuFeu added documentation Improvements or additions to documentation or sample code enhancement New feature or request labels Dec 26, 2023
@PattaFeuFeu PattaFeuFeu self-assigned this Dec 26, 2023
Copy link

codecov bot commented Dec 26, 2023

Codecov Report

Attention: 128 lines in your changes are missing coverage. Please review.

Comparison is base (6960044) 50.01% compared to head (c6e765d) 49.84%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #404      +/-   ##
============================================
- Coverage     50.01%   49.84%   -0.17%     
- Complexity      620      661      +41     
============================================
  Files           155      162       +7     
  Lines          4243     4484     +241     
  Branches        269      284      +15     
============================================
+ Hits           2122     2235     +113     
- Misses         1885     1996     +111     
- Partials        236      253      +17     
Files Coverage Δ
...e/src/main/kotlin/social/bigbone/MastodonClient.kt 35.29% <100.00%> (+0.16%) ⬆️
...igbone/src/main/kotlin/social/bigbone/api/Range.kt 100.00% <100.00%> (ø)
...n/social/bigbone/api/entity/admin/AccountOrigin.kt 100.00% <100.00%> (ø)
...n/social/bigbone/api/entity/admin/AccountStatus.kt 100.00% <100.00%> (ø)
...l/bigbone/api/entity/admin/ActionAgainstAccount.kt 100.00% <100.00%> (ø)
.../src/main/kotlin/social/bigbone/api/entity/Role.kt 97.50% <97.50%> (ø)
...in/social/bigbone/api/entity/admin/AdminAccount.kt 39.58% <39.58%> (ø)
...al/bigbone/api/method/admin/AdminAccountMethods.kt 55.71% <55.71%> (ø)
...n/social/bigbone/rx/admin/RxAdminAccountMethods.kt 0.00% <0.00%> (ø)

@PattaFeuFeu PattaFeuFeu changed the title Enhancement/323 admin accounts api part 1 Add Admin::Accounts methods Dec 26, 2023
@PattaFeuFeu PattaFeuFeu force-pushed the enhancement/323-admin-accounts-api-part-1 branch 2 times, most recently from 7455c1f to e051183 Compare December 26, 2023 21:07
@PattaFeuFeu PattaFeuFeu marked this pull request as ready for review December 26, 2023 21:09
@PattaFeuFeu PattaFeuFeu force-pushed the enhancement/323-admin-accounts-api-part-1 branch from e051183 to c6e765d Compare December 26, 2023 21:33
Copy link
Collaborator

@bocops bocops left a comment

Choose a reason for hiding this comment

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

Code looks good, I'm fine with everything you highlighted via comment.

I'm a bit short on time, so I didn't check the new assets in detail, but assume that those were just copied from available examples and are OK.

Would it be possible to refactor the apiName definition in the enums somehow, so that we don't have to repeat them that often? Doesn't need to happen in this PR, of course, but if at all possible, a new issue could be opened for that.

@PattaFeuFeu
Copy link
Collaborator Author

@bocops Thanks! If Role is alright with you in the current state, I can use the definition of this PR and use it in #411 as well 😊

I’ll create an issue regarding apiName to check. Might be possible to have an extension function that only works on enum classes tagged with Serializable.

@PattaFeuFeu
Copy link
Collaborator Author

@bocops Created: #412

@PattaFeuFeu PattaFeuFeu merged commit 90c8259 into master Dec 28, 2023
4 of 5 checks passed
@PattaFeuFeu PattaFeuFeu deleted the enhancement/323-admin-accounts-api-part-1 branch December 28, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation or sample code enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Admin Accounts API (Part 2/2) Implement Admin Accounts API (Part 1/2)
2 participants