Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 

apex-mastodon

Apex Library for mastodon

Install

If you can use jsforce-deploy command, execute following command.

$ git clone https://github.com/tzmfreedom/apex-mastodon
$ jsforce-deploy -D apex-mastodon/src -u {USERNAME} -p {PASSWORD}

For spm user

$ spm install tzmfreedom/apex-mastodon/src -u {username} -p {password}

For docker user

$ docker run --rm tzmfree/spm install tzmfreedom/apex-mastodon/src -u {username} -p {password}

Usage

Authorization

You can authenticate with named credentials.

Mastodon_Client client = new Mastodon_Client('callout:{named_credential_name}');

Resource Owner Password Credentials Grant

Mastodon_Client client = new Mastodon_Client('https://{instance_host}', '{client_id}', '{client_secret}', '{redirect_uri}');
client.authorizeByCredential('{username}', '{password}');

Authorization Code Grant

Mastodon_Client client = new Mastodon_Client('https://{instance_host}', '{client_id}', '{client_secret}', '{redirect_uri}');
String authorizeUrl = client.getAuthorizeUrl('{scope}', '{state}');
...
client.authorizeByCode('{code}');

Call API

Post Status

Mastodon_Status result = client.postStatus(new Mastodon_Toot('hello mastodon'));

Status of implementations

  • GET /api/v1/accounts/:id
  • GET /api/v1/accounts/verify_credentials
  • PATCH /api/v1/accounts/update_credentials
  • GET /api/v1/accounts/:id/followers
  • GET /api/v1/accounts/:id/following
  • GET /api/v1/accounts/:id/statuses
  • POST /api/v1/accounts/:id/follow
  • POST /api/v1/accounts/:id/unfollow
  • POST /api/v1/accounts/:id/block
  • POST /api/v1/accounts/:id/unblock
  • POST /api/v1/accounts/:id/mute
  • POST /api/v1/accounts/:id/unmute
  • GET /api/v1/accounts/relationships
  • GET /api/v1/accounts/search
  • POST /api/v1/apps
  • GET /api/v1/blocks
  • GET /api/v1/favourites
  • GET /api/v1/follow_requests
  • POST /api/v1/follow_requests/:id/authorize
  • POST /api/v1/follow_requests/:id/reject
  • POST /api/v1/follows
  • GET /api/v1/instance
  • POST /api/v1/media
  • GET /api/v1/mutes
  • GET /api/v1/notifications
  • GET /api/v1/notifications/:id
  • POST /api/v1/notifications/clear
  • GET /api/v1/reports
  • POST /api/v1/reports
  • GET /api/v1/search
  • GET /api/v1/statuses/:id
  • GET /api/v1/statuses/:id/context
  • GET /api/v1/statuses/:id/card
  • GET /api/v1/statuses/:id/reblogged_by
  • GET /api/v1/statuses/:id/favourited_by
  • POST /api/v1/statuses
  • DELETE /api/v1/statuses/:id
  • POST /api/v1/statuses/:id/reblog
  • POST /api/v1/statuses/:id/unreblog
  • POST /api/v1/statuses/:id/favourite
  • POST /api/v1/statuses/:id/unfavourite
  • GET /api/v1/timelines/home
  • GET /api/v1/timelines/public
  • GET /api/v1/timelines/tag/:hashtag

LICENSE

MIT

About

Apex Library for mastodon

Resources

License

Releases

No releases published

Packages

No packages published