Skip to main content

lib/api/meta/meta.ex

# Generated by `mix github.gen` from docs/github-api/api.github.com.json.
# Do not edit by hand; re-run the task instead.

defmodule Noizu.Github.Api.Meta do
  @moduledoc """
  GitHub `meta` API.
  """
  import Noizu.Github

  @doc """
  Get GitHub meta information

  @see https://docs.github.com/rest/meta/meta#get-apiname-meta-information
  """
  def get(options \\ nil) do
    url = github_base() <> "/meta"
    body = %{}
    api_call(:get, url, body, Noizu.Github.ApiOverview, options)
  end

  @doc """
  Get all API versions

  @see https://docs.github.com/rest/meta/meta#get-all-api-versions
  """
  def get_all_versions(options \\ nil) do
    url = github_base() <> "/versions"
    body = %{}
    api_call(:get, url, body, Noizu.Github.Collection, options)
  end

  @doc """
  Get Octocat

  @see https://docs.github.com/rest/meta/meta#get-octocat
  """
  def get_octocat(options \\ nil) do
    url =
      (
        query =
          [
            get_field(:s, options, nil)
          ]
          |> Enum.filter(& &1)

        qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
        github_base() <> "/octocat" <> qs
      )

    body = %{}
    api_call(:get, url, body, Noizu.Github.Raw, options)
  end

  @doc """
  Get the Zen of GitHub

  @see https://docs.github.com/rest/meta/meta#get-the-zen-of-github
  """
  def get_zen(options \\ nil) do
    url = github_base() <> "/zen"
    body = %{}
    api_call(:get, url, body, Noizu.Github.Raw, options)
  end

  @doc """
  GitHub API Root

  @see https://docs.github.com/rest/meta/meta#github-api-root
  """
  def root(options \\ nil) do
    url = github_base() <> "/"
    body = %{}
    api_call(:get, url, body, Noizu.Github.Root, options)
  end
end