Last active
April 1, 2022 14:05
-
-
Save wolves/3b13903ef8c8322b191c3510334cff90 to your computer and use it in GitHub Desktop.
Elixir curl Github API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repo_data = [name: "asdf"] | |
{status, result} = JSON.encode(repo_data) | |
IO.puts "RESULT: #{result}" | |
case System.cmd "curl", ["-XPOST", "-H", "Authorization: token #{github_token}", "https://api.github.com/user/repos", "-d", "#{result}"] do | |
{output, 0} -> IO.puts "#{output}" | |
{err, code} -> {:error, %Raygun.Error{message: err, command: "new", code: code}} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment