instance.get_instance -> instance.get

This commit is contained in:
lewdum 2024-10-22 19:00:31 -03:00
parent ec177f2b60
commit 82b6564ae1
No known key found for this signature in database
2 changed files with 2 additions and 4 deletions

View file

@ -8,7 +8,7 @@ pub fn main() {
let assert Ok(instance) = let assert Ok(instance) =
apkallone.Client("https://tech.lgbt") apkallone.Client("https://tech.lgbt")
|> instance.get_instance |> instance.get
io.debug(instance) io.debug(instance)
} }

View file

@ -4,9 +4,7 @@ import apkallone
import apkallone/internal import apkallone/internal
import apkallone/mastodon/model/instance.{type Instance} import apkallone/mastodon/model/instance.{type Instance}
pub fn get_instance( pub fn get(client: apkallone.Client) -> Result(Instance, apkallone.Error) {
client: apkallone.Client,
) -> Result(Instance, apkallone.Error) {
use req <- result.try(internal.prepare_request(client, "/api/v2/instance")) use req <- result.try(internal.prepare_request(client, "/api/v2/instance"))
use res <- result.try(internal.send_request(req)) use res <- result.try(internal.send_request(req))
internal.decode_response(res, instance.decode) internal.decode_response(res, instance.decode)