Code Monkey home page Code Monkey logo

bigbone's People

Contributors

andregasser avatar anuraagreddy123 avatar aoisensi avatar bocops avatar dependabot[bot] avatar g10xy avatar grobmeier avatar hero-matsumoto avatar lamrongol avatar melix avatar meronmks avatar moko256 avatar multicolorworld avatar nightm4re94 avatar pattafeufeu avatar shibafu528 avatar siddharth052002 avatar sys1yagi avatar takke avatar wakingrufus avatar yeroc avatar yordaniss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bigbone's Issues

Add missing fields to Account entity

The following fields are currently missing in the Account entity class:

  • bot
  • discoverable
  • group
  • avatar_static
  • header_static
  • last_status_at
  • noindex
  • fields
  • moved
  • suspended
  • limited

Hide implementation details from library users

OkHttp3 and Gson leak through the client-side API. Check if really necessary and change if needed. Leaking details to the library users makes it difficult to change implementation details without breaking the API.

Add missing fields to Relationship entity

The following fields are currently missing in the Relationship entity class:

  • showing_reblogs
  • notifying
  • languages
  • blocked_by
  • muting_notifications
  • requested
  • domain_blocking
  • endorsed
  • note

Enable checkstyle

In order to maintain a consistend code style. It should be integrated into the gradle check command (same as detekt).

Using undocumented OAuth method?

There's a postUserNameAndPassword() method that gets an access token by posting user credentials to the /oauth/token endpoint directly while using a "grant_type":"password" parameter:

https://github.com/andregasser/mastodon4j/blob/c19e7a3b728faa345ea71fbdb1231b3e627be2d6/mastodon4j/src/main/kotlin/com/sys1yagi/mastodon4j/api/method/Apps.kt#L90-L118

This method is used in example code of this project, from where I got the idea to also use it in my PR #10.

This parameter seems to be not officially supported by the Mastodon API, which only mentions parameter values authorization_code and client_credentials: Mastodon API documentation for /oauth/token

Apparently, sending username/password works via Mastodon's Doorkeeper configuration here, which explicitly warns about enabling the password grant flow, linking to: https://www.rfc-editor.org/rfc/rfc6819#section-4.4.3

I think we need to deal with this one way or another, although I'm not sure how. We should either

  • remove functionality that is not part of the documented API completely, because it might fail at any moment, or at least
  • document the above both in code and in places like USAGE.md, and urge users to properly use OAuth instead.

"Get started" guide is outdated/wrong

The "Get started" guide (now in USAGE.md after move from README.md) is outdated and/or wrong. Just following it from the top, the third line of code

val statuses: List<Status> = timelines.getPublic().execute()

is the first one to fail, because Timelines apparently hasn't had a getPublic() method for five years. Fixing it to use getHome() instead and dealing with it not returning a List<Status> but Pageable<Status>, this still fails with a Mastodon4jRequestException claiming that I'm unauthorized to do so.

Further down the guide, I see a section about getting the Home Timeline that includes an access token - but that, too, implies that the return value is a List, which it isn't.

In the past, I tried following another part of the guide to get that access token, stumbled upon the incomplete OAuth part, but eventually managed to get some token back from my Mastodon server, only for all attempts at writing a test status to fail, although I requested ALL scope.

Without yet having a full grasp on either Mastodon's API or the way it was implemented here, I'm basically poking random things with a stick to see what moves and what doesn't. I'd love to see working example code that:

  • actually implements the complete process to authorize and receive a proper access token, without leaving out some steps
  • uses that token to get at least one status from a server (for example the most recent status of the home timeline) and works with it (for example printing its content)
  • uses that token to send a status (for example an unlisted "Hello World" status),
  • all while having some actually useful comments for the parts left out for some reason.
  • EDIT: three items of the comment below should also be handled before closing this.

Remove postUrl() special case

MastodonClient currently has both a post() and a postUrl() method. After #35 is resolved, the latter can be removed and calls to it be replaced with calls to the former, potentially avoiding cases where postUrl() is used to post to a URL with a different host than what the client is configured for.

Rework Follows.kt

Follows.postRemoteFollow() currently posts to /api/v1/follows and returns an Account. Does this actually do anything?

Closest I could find in Mastodon API is the endpoint /api/v1/accounts/:id/follow returning a Relationship. Is that what we actually want to do here, or am I missing something obvious?

https://docs.joinmastodon.org/methods/accounts/#follow

Create CHANGELOG.md

In order to transparently list changed to the library releases. Would be nice if we had a proper changelog with the 2.0.0 release to hightlight, what has changes since we forked mastodon4j.

Switch from JitPack to Maven Central

The current plan is to publish this library on Maven Central. We need to change the gradle build accordingly and set proper configuration (like group id, artifact id, ...)

Enable PMD

For code quality reasons, works complementarily to Checkstyle. Should also be added to the gradle check command.

Migrate sample code from USAGE.md into samples collection

As discussed here, the code in USAGE.md should be merged into our samples collection, currently available in the sample and the sample-kotlinmodules.

Main tasks include:

  • Check if samples present in USAGE.md are entirely missing in our samples collection. If yes, add a sample to the samples collection for Java and Kotlin each.
  • Delete USAGE.md

Refactor Streaming API

By looking at the code, I can see a lot of code duplication. Would be cool, if we could clean that up somehow.

Split README.md into separate documents

README.md is currently a lengthy list containing everything, making it a bit unreadable at times. I suggest to move the following parts into their own files:

  • Usage section (into USAGE.md?) so that an implementation reference exists that can be updated separately. A later change could move this into a docs/ directory and expand individual elements as necessary
  • Implementation Progress section (into API.md?), also sorting by endpoint hierarchy and checking with Mastodon's documentation which methods might have been added in the meantime.

This would leave the following parts in README.md, where they could be expanded upon:

  • Introduction, including link to Mastodon API and "Get Started"
  • Semantic Versioning reference
  • Contribution
  • License

If that is OK, I could work on it and send a PR.

Add missing fields to Report entity

Mastodon provides a Reports API which has API calls that return a Report entity. While we already provide a basic implementation of this endpoint, the Report entity currently does not implement all the fields returned by Mastodon servers. The following fields are missing and should be added to the entity:

  • action_taken_at
  • category
  • comment
  • forwarded
  • created_at
  • status_ids
  • rule_ids
  • target_account

The Report entity is documented here:
https://docs.joinmastodon.org/entities/Report/

Please consult the following documents to make sure your contribution meets our projects criteria:

Integration testing with testcontainers

Let's try to create an integration test with testcontainers and a docker-compose setup. I already have the docker-compose part ready. Just need to get started with the testcontainers part.

Move Gson serialization into MastodonClient

Originally posted to #5:

Currently, basically every API method looks like this:

    fun getAccount(accountId: Long): MastodonRequest<Account> {
        return MastodonRequest(
            { client.get("api/v1/accounts/$accountId") },
            { client.getSerializer().fromJson(it, Account::class.java) }
        )
    }

with the Gson instance being exposed via MastodonClient.getSerializer(). It is probably cleaner to change this into something like a call to client.getMastodonRequest(...), which would deal with the necessary serialization in our MastodonClient instead.

2.0.0 release preparation

Includes the following tasks:

  • Bump version to 2.0.0
  • Add CONTRIBUTING.md
  • README.md: Update artifact coordinates in README.md
  • Publish to Maven Central
  • README.md: Update badges

Create a release roadmap

In order to plan releases after 2.0.0, we should have some sort of a release roadmap, which outlines what we are working on next. It does not have to be a huge or so, but just help us to prioritize issues to work on and group them into potential releases. Also, we should make sure, we can group breaking changes together as good as we can.

Align method classes with API structure in the official docs

Our method classes should be aligned with the API documentation structure that is offered in the documentation, as it makes using our API easier. People find methods they're looking for quicker. For example "instance" is listed as a separat "APi method" in the documentation, wheras in our API, methods are hidden in other places, such as "Public.kt". In this case, it would make sense to introduce a separate method class called "Instance".

A similar case is "search" any probably others as well.

Change type of id field in entities to from Long to String if necessary

Some entities in the "entity" package specify an "id" attribute of type Long. According to the API docs, ids are not guarenteed to be numeric and should have a data type of String instead. Alle entities should quickly be reviewed against API documentation and data type switched if necessary.

Add missing fields to Notification entity

Mastodon provides a Notifications API which has API calls that return a Notification entity. While we already provide a basic implementation of this endpoint, the Notification entity currently does not implement all the fields returned by Mastodon servers. The following fields are missing and should be added to the entity:

  • report

The Notification entity is documented here:
https://docs.joinmastodon.org/entities/Notification/

Please consult the following documents to make sure your contribution meets our projects criteria:

Update API.md

In API.md, I have started to document all the endpoint that Mastodon servers offer today. We know that a lot of endpoints are not yet implemented in Bigbone, but there are also endpoints which are only implemented partially (basic functionality might be there, but some special parameters might not be supported, just to give an example).

This list is not yet complete and I need to go through each endpoint and document, if all the query options are supported or not. If not, I need to quickly take a note on what is missing.

After that list is created, we can plan the next feature releases where we add more endpoint functionality.

RfE: Provide a simplified Media upload api

The current api for media upload is complicated and requires multiple steps, which are not super well documented (already in the original mastodon4j code).
Provide a simple Media.upload() method / builder, that 'asks' for the required parts and does the magic of MultipartBody.Part handling under the covers. One option would be some fromFile() and/or fromResource() / fromUrl() builder methods to upload the actual content.

Add documentation to our API

All of the API functionality we offer should be documented using proper Kdoc. This will help users of this library by displaying information about any functionality they might want to use directly in their IDE.

Remove clutter from API method names

Most of the API method names have the HTTP request type prefixed, such as postReblog(...) or postUnreblog in Statuses.kt. This could be simplified into just reblog(..) and unreblog(...). Of course there are cases where a prefix like get is completely valid. Those should stay of course.

Enable automatic snapshot publishing on push to master

When changes are pushed into master, I would like to automatically push a new snapshot build to Maven Central. Now it's a manual process. A GItHub action needs to be built for this that performs a gradlew publish command more or less.

Project not available via Jitpack

This project seems to be currently unavailable via Jitpack. Due to the error message

Tag or commit '1.7.0' not found. Rechecking.

I assume that this is because this project, other than upstream, does not have any releases defined. I'm not sure if you actually want to start defining releases already - if not, having a small note in the Get Started section of README.md mentioning that including this project currently doesn't work could be an alternative.

Hardcoded "/api/v1" path prefix

The path prefix to "api/v1" is currently hardcoded in MastodonClient.kt. This will be problematic once V2 endpoints need to be added, but is already an issue for the OAuth endpoints that aren't located under "/api".

The current workaround is to offer a separate postUrl(String, Parameter) method that interprets its string input as a full URL, whereas post(String, Parameter) interprets its input as additional path segments under "api/v1". Both the fact that the two methods have an identical signature and the fact that there's no check on whether the full URL even uses the same host as defined as instanceName can lead to issues down the line.

This could be solved by moving the full path to each endpoint out of MastodonClient and into each of its callers. At the same time, building the final URLs can be moved from doing it ourselves to using okHttp.HttpUrl and its builder throughout, which might prevent more bugs from happening.

I'm already working on the OkHttp part of #5, so I could tackle this in the process.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.