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 {