馃悁 ATproto library for gleam
atproto library gleam
35

Configure Feed

Select the types of activity you want to include in your feed.

49 1 13

Clone this repository

https://tangled.org/kacaii.dev/possum https://tangled.org/did:plc:f2s2nd3tnw75so75ndrns6s2
git@tangled.org:kacaii.dev/possum git@tangled.org:did:plc:f2s2nd3tnw75so75ndrns6s2

For self-hosted knots, clone URLs may differ based on your setup.



README.md

Possum#

馃悁 ATproto library for gleam.

Helps you build HTTP requests that interact with your Personal Data Server. The user is responsible for sending the request and decode the response.

AT Protocol#

The "Atmosphere" is the term used to describe the ecosystem around the AT Protocol.

The AT Protocol stands for "Authenticated Transfer Protocol," and is frequently shortened to "atproto." The name is in reference to the fact that all user-data is signed by the authoring users, which makes it possible to broadcast the data through many services and prove it's real without having to speak directly to the originating server.

source: https://atproto.com/guides/glossary

Example#

gleam add gleam_http
possum = { git = "https://tangled.org/kacaii.dev/possum", ref = "commit-hash" }
import gleam/http/request
import possum

const did = "did:plc:ewvi7nxzyoun6zhxrhs64oiz"

pub fn main() -> Nil {
  // Resolving a DID document.
  // This returns information about a Decentralized Identifier (DID),
  // including their handle and their service endpoint, where their Personal
  // Data Server (PDS) is located.
  request.new()
  |> possum.get_plc_data(did)

  // You also query your identifier by sending a request directly to your PDS.
  request.new()
  |> request.set_host("personal.data-server.pds")
  |> possum.resolve_handle("tangled.org")

  // Acquiring a JWT token
  // App Passwords can be generated in you Bluesky settings.
  request.new()
  |> request.set_host("personal.data-server.pds")
  |> possum.create_session(did, "bsky-app-password", option.None, option.None)

  // Includeng a authorization Header for requests that require authentication
  request.new()
  |> request.set_host("personal.data-server.pds")
  |> possum.authorized("my-access-token")

  // Refreshing an authorized Session
  request.new()
  |> request.set_host("personal.data-server.pds")
  |> possum.refresh_session("refresh-token")

  // Reading public data from a repository.
  // No authorization needed.
  request.new()
  |> request.set_host("personal.data-server.pds")
  |> possum.list_records(
    repository: did,
    collection: "site.standard.document",
    limit: option.Some(3),
    cursor: option.None,
    reverse: option.None,
  )
}