diff --git a/src/Mastodon.elm b/src/Mastodon.elm index 0d00821..01d4574 100644 --- a/src/Mastodon.elm +++ b/src/Mastodon.elm @@ -169,12 +169,13 @@ type alias AccessTokenResult = -- Encoders -appRegistrationEncoder : String -> String -> String -> Encode.Value -appRegistrationEncoder client_name redirect_uris scope = +appRegistrationEncoder : String -> String -> String -> String -> Encode.Value +appRegistrationEncoder client_name redirect_uris scope website = Encode.object [ ( "client_name", Encode.string client_name ) , ( "redirect_uris", Encode.string redirect_uris ) , ( "scopes", Encode.string scope ) + , ( "website", Encode.string website ) ] @@ -366,11 +367,11 @@ registrationEncoder registration = ] -register : Server -> String -> String -> String -> HttpBuilder.RequestBuilder AppRegistration -register server client_name redirect_uri scope = +register : Server -> String -> String -> String -> String -> HttpBuilder.RequestBuilder AppRegistration +register server client_name redirect_uri scope website = HttpBuilder.post (server ++ "/api/v1/apps") |> HttpBuilder.withExpect (Http.expectJson (appRegistrationDecoder server scope)) - |> HttpBuilder.withJsonBody (appRegistrationEncoder client_name redirect_uri scope) + |> HttpBuilder.withJsonBody (appRegistrationEncoder client_name redirect_uri scope website) getAuthorizationUrl : AppRegistration -> String diff --git a/src/Model.elm b/src/Model.elm index 0b9243d..8b28180 100644 --- a/src/Model.elm +++ b/src/Model.elm @@ -95,6 +95,7 @@ registerApp { server, location } = "tooty" appUrl "read write follow" + appUrl |> Mastodon.send AppRegistered