Current section

Files

Jump to
noizu_github lib api structs code_search_result_item.ex
Raw

lib/api/structs/code_search_result_item.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.CodeSearchResultItem do
@moduledoc false
defstruct [
:file_size,
:git_url,
:html_url,
:language,
:last_modified_at,
:line_numbers,
:name,
:path,
:repository,
:score,
:sha,
:text_matches,
:url
]
def from_json(json, headers \\ [])
def from_json(nil, _headers), do: nil
def from_json(list, headers) when is_list(list) do
Enum.map(list, &from_json(&1, headers))
end
def from_json(json, _headers) when is_map(json) do
%__MODULE__{
file_size: Map.get(json, :file_size),
git_url: Map.get(json, :git_url),
html_url: Map.get(json, :html_url),
language: Map.get(json, :language),
last_modified_at: Map.get(json, :last_modified_at),
line_numbers: Map.get(json, :line_numbers),
name: Map.get(json, :name),
path: Map.get(json, :path),
repository: Noizu.Github.MinimalRepository.from_json(Map.get(json, :repository)),
score: Map.get(json, :score),
sha: Map.get(json, :sha),
text_matches: Map.get(json, :text_matches),
url: Map.get(json, :url)
}
end
def from_json(other, _headers), do: other
end