#!/usr/bin/env elixir Mix.install([ {:req, "~> 0.5.10"} ]) {opts, []} = OptionParser.parse!(System.argv(), strict: [ instance: :string, client_name: :string, redirect_uri: :string, scopes: :string, website: :string ] ) instance = Keyword.fetch!(opts, :instance) client_name = Keyword.get(opts, :client_name, "sloanelybutsurely.com") redirect_uri = Keyword.get(opts, :redirect_uri, "https://sloanelybutsurely.com/auth/mastodon/callback") scopes = Keyword.get(opts, :scopes, "read write push") website = Keyword.get(opts, :website, "https://sloanelybutsurely.com") %{status: 200, body: resp} = Req.post!( base_url: instance, url: "/api/v1/apps", json: %{ client_name: client_name, redirect_uris: [redirect_uri], scopes: scopes, website: website } ) IO.inspect(resp)