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 missing REST endpoints #50

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

shavs
Copy link

@shavs shavs commented Jul 3, 2021

As noted in #49, I made a list of the endpoints that (at the time) I believed were missing.

After finding some time to sit down and go through the document, I think I've made the relevant adjustments to cover a large number of missing endpoints.

I apologise for the massive wall of text that's about to follow, but it documents where I've got to with filling in the gaps.

Unfortunately, this only covers the REST endpoints, not streaming endpoints. Additionally, these changes lack tests, which is also my fault. However, I didn't feel justified in spamming mastodon.social with test runs. Where possible, I have tested the endpoints manually using botsin.space as a test instance, and using binding.irb calls.

If there is anything that you would like me to do to aid the closure of #49, I will make it a priority from my perspective so that the gem can get a new release.

I don't typically use GitHub for development, so I also apologise if this is not correct behaviour.


Endpoints I falsely stated were missing

  • Accounts
    • Main account methods
      • Statuses
        • Method: GET
        • Route: /api/v1/accounts/#{id}/statuses
      • Feature on Profile (pins)
        • Method: POST
        • Route: /api/v1/accounts/#{id}/pin
      • Unfeature on Profile (unpin)
        • Method: POST
        • Route: /api/v1/accounts/#{id}/unpin
    • Suggestions
      • Follow suggestions
        • Method: GET
        • Route: /api/v1/suggestions
      • Remove a suggestion
        • Method: DELETE
        • Route: /api/v1/suggestions/#{account_id}
  • Reports
    • Create a Report
      • Method: POST
      • Route: /api/v1/reports
  • Notifications
    • Main notification methods
      • Dismiss a single notification
        • Method: POST
        • Route: /api/v1/notifications/#{id}/dismiss

Endpoints that I've implemented in the Gem

  • Accounts
    • Main account methods
      • Lists
        • Method: GET
        • Route: /api/v1/accounts/#{id}/lists
      • Identity Proofs
        • Method: GET
        • Route: /api/v1/accounts/#{id}/identity_proofs
    • Favourites
      • Method: GET
      • Route: /api/v1/favourites
    • Featured Tags
      • View your featured tags
        • Method: GET
        • Route: /api/v1/featured_tags
      • Feature a tag
        • Method: POST
        • Route: /api/v1/featured_tags
      • Unfeature a tag
        • Method: DELETE
        • Route: /api/v1/featured_tags/#{id}
      • Suggested tags to feature
        • Method: GET
        • Route: /api/v1/featured_tags/suggestions
  • Apps
    • OAuth
      • Obtain a Token
        • Method: POST
        • Route: /api/v1/oauth/token
      • Revoke token
        • Method: POST
        • Route: /api/v1/oauth/revoke
  • Statuses
    • Polls
      • View a poll
        • Method: GET
        • Route: /api/v1/polls/#{id}
      • Vote on a poll
        • Method: POST
        • Route: /api/v1/polls/#{id}/votes
  • Notifications
    • Main notification methods
      • Get a single notification
        • Method: GET
        • Route: /api/v1/notifications/#{id}
  • Notifications
    • Push
      • Subscribe to push notifications
        • Method: POST
        • Route: /api/v1/push/subscription
      • Get current subscription
        • Method: GET
        • Route: /api/v1/push/subscription
      • Change types of notifications
        • Method: PUT
        • Route: /api/v1/push/subscription
      • Remove current subscription
        • Method: DELETE
        • Route: /api/v1/push/subscription
  • Directory
    • View profile directory
      • Method: GET
      • Route /api/v1/directory
  • Trends
    • Trending tags
      • Method: GET
      • Route: /api/v1/trends
  • Announcements
    • View all announcements
      • Method: GET
      • Route: /api/v1/announcements
    • Dismiss an announcements
      • Method: POST
      • Route: /api/v1/announcements/#{id}/dismiss
    • Add reaction
      • Method: PUT
      • Route: /api/v1/announcements/#{id}/reactions/#{name}
    • Remove reaction
      • Method: DELETE
      • Route: /api/v1/announcements/#{id}/reactions/#{name}

Endpoints I'm not sure about

  • Accounts
    • Bookmarks (might be deprecated, not sure whether to bother to implement for Bookmarks)
      • Method: GET
      • Route: /api/v1/bookmarks
    • Reports (some of the documentation was missing, I think this API endpoint is missing/removed now)
      • File a report
        • Method: GET
        • Route: /api/v1/reports
    • Preferences (I think I can implement this, but I'm not sure how to represent this, because of the weird shaping of the response keys (<string>:<string>:<string>))
      • View user preferences
        • Method: GET
        • Route: /api/v1/preferences
  • Apps
    • OAuth
      • Authorize (not sure about this, since the response is a string/page to fill in)
        • Method: GET
        • Route: /api/v1/oauth/authorize
  • Statuses
    • Media
      • Update an attachment (Get an Attachment, before it is attached to a status and posted...) (Not sure how to represent this with the current object/request method calls - would have to have a File passed through to request)
        • Method: GET
        • Route: /api/v1/media/#{id}
      • Focal points
        • No direct API documentation exists for this
  • Timelines
    • Markers (They return a hash -> object representation, not sure if this should return an object instead (Mastodon::MarkerCollection or similar), with sub-objects of Mastodon::Marker?)
      • Get saved timeline position
        • Method: GET
        • Route: /api/v1/markers
      • Save position in timeline
        • Method: POST
        • Route: /api/v1/markers
  • Admin (not currently complete documentation for API, there's also an Admin CLI (though it would be useful to have Admin calls in a separate library))
  • Proofs (not sure how to represent this, unless just to directly return the response)
    • View identity proof
      • Method: GET
      • Route: /api/proofs
  • OEmbed (not sure how to represent this, unless just to directly return the response)
    • OEmbed as JSON
      • Method: GET
      • Route: /api/oembed

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.

None yet

1 participant