# 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.ApiInsights do
@moduledoc """
GitHub `api-insights` API.
"""
import Noizu.Github
@doc """
Get route stats by actor
@see https://docs.github.com/rest/orgs/api-insights#get-route-stats-by-actor
"""
def get_route_stats_by_actor(org, actor_type, actor_id, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil),
get_field(:page, options, nil),
get_field(:per_page, options, nil),
get_field(:direction, options, nil),
get_field(:sort, options, nil),
get_field(:api_route_substring, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/route-stats/#{actor_type}/#{actor_id}" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Raw, options)
end
@doc """
Get subject stats
@see https://docs.github.com/rest/orgs/api-insights#get-subject-stats
"""
def get_subject_stats(org, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil),
get_field(:page, options, nil),
get_field(:per_page, options, nil),
get_field(:direction, options, nil),
get_field(:sort, options, nil),
get_field(:subject_name_substring, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/subject-stats" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Raw, options)
end
@doc """
Get summary stats
@see https://docs.github.com/rest/orgs/api-insights#get-summary-stats
"""
def get_summary_stats(org, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/summary-stats" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.ApiInsightsSummaryStats, options)
end
@doc """
Get summary stats by actor
@see https://docs.github.com/rest/orgs/api-insights#get-summary-stats-by-actor
"""
def get_summary_stats_by_actor(org, actor_type, actor_id, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/summary-stats/#{actor_type}/#{actor_id}" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.ApiInsightsSummaryStats, options)
end
@doc """
Get summary stats by user
@see https://docs.github.com/rest/orgs/api-insights#get-summary-stats-by-user
"""
def get_summary_stats_by_user(org, user_id, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/summary-stats/users/#{user_id}" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.ApiInsightsSummaryStats, options)
end
@doc """
Get time stats
@see https://docs.github.com/rest/orgs/api-insights#get-time-stats
"""
def get_time_stats(org, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil),
get_field(:timestamp_increment, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/time-stats" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Raw, options)
end
@doc """
Get time stats by actor
@see https://docs.github.com/rest/orgs/api-insights#get-time-stats-by-actor
"""
def get_time_stats_by_actor(org, actor_type, actor_id, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil),
get_field(:timestamp_increment, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/time-stats/#{actor_type}/#{actor_id}" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Raw, options)
end
@doc """
Get time stats by user
@see https://docs.github.com/rest/orgs/api-insights#get-time-stats-by-user
"""
def get_time_stats_by_user(org, user_id, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil),
get_field(:timestamp_increment, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/time-stats/users/#{user_id}" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Raw, options)
end
@doc """
Get user stats
@see https://docs.github.com/rest/orgs/api-insights#get-user-stats
"""
def get_user_stats(org, user_id, options \\ nil) do
url =
(
query =
[
get_field(:min_timestamp, options, nil),
get_field(:max_timestamp, options, nil),
get_field(:page, options, nil),
get_field(:per_page, options, nil),
get_field(:direction, options, nil),
get_field(:sort, options, nil),
get_field(:actor_name_substring, options, nil)
]
|> Enum.filter(& &1)
qs = if query == [], do: "", else: "?" <> Enum.join(query, "&")
github_base() <> "/orgs/#{org}/insights/api/user-stats/#{user_id}" <> qs
)
body = %{}
api_call(:get, url, body, Noizu.Github.Raw, options)
end
end