From 508e125fdc56d2502c838e4d230b07607503acdd Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Fri, 31 Jul 2026 22:44:28 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20a=20'document=5Frequest'=20co?= =?UTF-8?q?nvenience=20function=20for=20resolving=20did=20documents.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/at/did.gleam | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/at/did.gleam b/src/at/did.gleam index bf35fb5..cf618e1 100644 --- a/src/at/did.gleam +++ b/src/at/did.gleam @@ -4,6 +4,8 @@ import at/internal/ascii import at/internal/base32 import at/internal/hostname import gleam/dynamic/decode.{type Decoder} +import gleam/http.{Get, Https} +import gleam/http/request.{type Request, Request} import gleam/int import gleam/json.{type Json} import gleam/list @@ -434,6 +436,25 @@ pub fn document_uri(did: Did) -> Uri { } } +/// +/// +pub fn document_request(did: Did) -> Request(String) { + let assert Uri(host: Some(host), port:, path:, ..) = document_uri(did) + + Request( + method: Get, + headers: [ + #("accept", "application/json"), + ], + body: "", + scheme: Https, + host:, + port:, + path:, + query: None, + ) +} + /// Serialise a [`Did`](#Did) to JSON. /// pub fn to_json(did: Did) -> Json { -- 2.51.2