megalodon

A portable Mastodon-compatible Fediverse API client for MoonBit.

fediverse
mastodon
pleroma
client
moon add marianoguerra/megalodon@0.1.0
Download zip
Version
0.1.0
License
Apache-2.0
Last updated
2 days ago
Downloads
6
README

#megalodon

A portable Mastodon-compatible Fediverse client for MoonBit. The core module has no external dependencies and supports wasm, wasm-gc, JavaScript, and native. Network access is supplied through @api.Transport; native applications can install marianoguerra/megalodon-http.

For a native application, add both modules:

moon add marianoguerra/megalodon@0.1.0 moon add marianoguerra/megalodon-http@0.1.0

Import the client and native transport packages in moon.pkg:

///|
import {
"marianoguerra/megalodon/client",
"marianoguerra/megalodon-http/transport",
}

///|
async fn main {
let transport = @transport.HttpTransport::new()
let client = @client.Client::new(
transport,
@client.Mastodon,
"https://mastodon.social",
access_token="...",
)
let account = client.verify_account_credentials().data
println(account.acct)
}

The generic Client::call accepts every non-streaming REST/OAuth operation in the frozen reference interface, and the same operations have named client methods. Client::raw is available for server extensions that postdate this release.

The core intentionally does not import an async runtime. An async trait method is part of MoonBit's language-level API; the executor belongs to the application or concrete transport.

Applications on other targets can implement @api.Transport and reuse the same client, OAuth, detector, and entity packages.

#
Account

The normalized account fields shared by the supported server families. raw preserves every vendor field verbatim.

#
Activity

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Announcement

using @marianoguerra/megalodon/entity { type EntityObject as Announcement }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Application

using @marianoguerra/megalodon/entity { type EntityObject as Application }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Card

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Context

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Conversation

using @marianoguerra/megalodon/entity { type EntityObject as Conversation }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Emoji

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Endpoint

The complete non-streaming, non-admin operation inventory from megalodon-rs/src/megalodon.rs at the revision recorded in provenance.

#
FeaturedTag

using @marianoguerra/megalodon/entity { type EntityObject as FeaturedTag }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Field

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Filter

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
FollowRequest

using @marianoguerra/megalodon/entity { type EntityObject as FollowRequest }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
History

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
HttpMethod

An HTTP method supported by the Mastodon-compatible REST API.

#
HttpRequest

A fully encoded outbound request. Transports must not reinterpret body.

#
IdentityProof

using @marianoguerra/megalodon/entity { type EntityObject as IdentityProof }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Instance

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
List

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Mention

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Notification

A normalized notification. Unknown notification kinds decode as Unknown.

#
Params

Ordered parameters permit repeated keys and deterministic tests.

#
Poll

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
PollOption

using @marianoguerra/megalodon/entity { type EntityObject as PollOption }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
PushSubscription

using @marianoguerra/megalodon/entity { type EntityObject as PushSubscription }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Quote

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
QuoteApproval

using @marianoguerra/megalodon/entity { type EntityObject as QuoteApproval }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
QuotedStatus

using @marianoguerra/megalodon/entity { type EntityObject as QuotedStatus }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Reaction

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Relationship

using @marianoguerra/megalodon/entity { type EntityObject as Relationship }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Report

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Results

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Role

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
ScheduledStatus

using @marianoguerra/megalodon/entity { type EntityObject as ScheduledStatus }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
ShallowQuote

using @marianoguerra/megalodon/entity { type EntityObject as ShallowQuote }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Source

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Stats

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
StatusSource

using @marianoguerra/megalodon/entity { type EntityObject as StatusSource }

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Tag

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Token

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
Transport

The portable seam between request construction and an HTTP implementation. Implementations should translate runtime/network failures to RequestFailed; status-code interpretation stays in the portable core.

#
URLs

Common object wrapper used for entities whose complete, server-specific shape remains available through raw.

#
generator

fn generator(transport : &
Transport
, software :
ServerSoftware
, base_url : String, access_token? : String, user_agent? : String) ->
Client

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io