Skip to content

Swift library for the ATProtocol and Bluesky, generated from Lexicons

Notifications You must be signed in to change notification settings

joshlacal/Petrel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

214 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Petrel — ATProto Swift Client

Petrel is a Swift client for the AT Protocol and Bluesky APIs. The primary entrypoint you use is ATProtoClient — it encapsulates authentication, networking, and all generated endpoints. You do not need to interact with internal services.

Quick start:

import Petrel

let oauth = OAuthConfig(
    clientId: "YOUR_CLIENT_ID",
    redirectUri: "yourapp://oauth/callback",
    scope: "atproto app:bsky"
)

let client = await ATProtoClient(
    baseURL: URL(string: "https://bsky.social")!,
    oauthConfig: oauth,
    namespace: "com.example.yourapp",
    userAgent: "YourApp/1.0"
)

// Start OAuth and handle callback
let authURL = try await client.startOAuthFlow(identifier: "yourhandle.bsky.social")
// … present authURL to the user, receive `callbackURL` in your app …
try await client.handleOAuthCallback(url: callbackURL)

// Call generated endpoints
let profile = try await client.app.bsky.actor.getProfile(
    AppBskyActorGetProfile.Parameters(actor: "alice.bsky.social")
)

See GETTING_STARTED.md for full usage.

About

Swift library for the ATProtocol and Bluesky, generated from Lexicons

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5