/SwiftyJoinMastodonAPI

Swift client library for the api.joinmastodon.org server listing

Primary LanguageSwiftMIT LicenseMIT

SwiftyJoinMastodonAPI

An easy way to work with the joinmastodon.org server listing API in Swift.

import SwiftyJoinMastodonAPI

// Get all servers
async let servers = JoinMastodonAPI.default.perform(.getServers)

// Get servers filtered by language, category, region, ownership type, or open registrations
async let filteredServers = JoinMastodonAPI.default.perform(.getServers(filterParameters: .init(
	language: "en",
	category: "general",
	region: .europe,
	registrations: .instant
)))

// Use a custom URLSession
let customURLSessionAPIClient = JoinMastodonAPI(urlSession: .init(configuration: .ephemeral))
async let stats = customURLSessionAPIClient.perform(.getStatistics)

Related projects

  • TootSDK - Once you've listed servers using SwiftyJoinMastodonAPI, you'll probably want to interact with them. TootSDK implements the Mastodon client API in a way that's compatible with many different Fediverse servers.