hexsha
stringlengths 40
40
| size
int64 2
991k
| ext
stringclasses 2
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
208
| max_stars_repo_name
stringlengths 6
106
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
sequence | max_stars_count
int64 1
33.5k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
208
| max_issues_repo_name
stringlengths 6
106
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
sequence | max_issues_count
int64 1
16.3k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
208
| max_forks_repo_name
stringlengths 6
106
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
sequence | max_forks_count
int64 1
6.91k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 2
991k
| avg_line_length
float64 1
36k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9e84181f10f06d18fcff0f9a561edc164d4df9aa | 865 | exs | Elixir | ch14-04.exs | gabrielelana/programming-elixir | 475319123d21b03c3bfcc02a23178ab9db67a6b3 | [
"MIT"
] | 9 | 2016-01-22T17:28:27.000Z | 2020-06-07T01:38:44.000Z | ch14-04.exs | gabrielelana/programming-elixir | 475319123d21b03c3bfcc02a23178ab9db67a6b3 | [
"MIT"
] | null | null | null | ch14-04.exs | gabrielelana/programming-elixir | 475319123d21b03c3bfcc02a23178ab9db67a6b3 | [
"MIT"
] | 1 | 2019-04-18T10:08:38.000Z | 2019-04-18T10:08:38.000Z | # Do the same as 14-03, but have the child raise an exception. What difference
# do you see in the tracing?
defmodule Programming.Elixir do
defmodule CallMeIfYouDie do
import :timer, only: [sleep: 1]
def child do
raise "oops" # The exception gets logged
end
def start do
Process.flag(:trap_exit, true)
spawn_link(__MODULE__, :child, [])
sleep 500
flush
end
defp flush do
receive do
message ->
# The exception is received as the exit reason
IO.puts("Received: #{inspect message}")
flush
after 100 ->
IO.puts("End of messages")
end
end
end
CallMeIfYouDie.start
# receives
# > Received: {:EXIT, #PID<0.55.0>, {%RuntimeError{message: "oops"}, [{Programming.Elixir.CallMeIfYouDie, :child, 0, [file: 'ch14-04.exs', line: 9]}]}}
end
| 23.378378 | 153 | 0.616185 |
9e8469e879d9dc36ac594236d8e30894d35e0e50 | 2,091 | ex | Elixir | lib/changelog/data/news/news_ad.ex | boneskull/changelog.com | 2fa2e356bb0e8fcf038c46a4a947fef98822e37d | [
"MIT"
] | null | null | null | lib/changelog/data/news/news_ad.ex | boneskull/changelog.com | 2fa2e356bb0e8fcf038c46a4a947fef98822e37d | [
"MIT"
] | null | null | null | lib/changelog/data/news/news_ad.ex | boneskull/changelog.com | 2fa2e356bb0e8fcf038c46a4a947fef98822e37d | [
"MIT"
] | null | null | null | defmodule Changelog.NewsAd do
use Changelog.Data
alias Changelog.{Files, NewsIssueAd, NewsSponsorship, Regexp}
schema "news_ads" do
field :url, :string
field :headline, :string
field :story, :string
field :image, Files.Image.Type
field :active, :boolean, default: true
field :newsletter, :boolean, default: false
field :impression_count, :integer, default: 0
field :click_count, :integer, default: 0
field :delete, :boolean, virtual: true
belongs_to :sponsorship, NewsSponsorship
has_many :news_issue_ads, NewsIssueAd, foreign_key: :ad_id, on_delete: :delete_all
has_many :issues, through: [:news_issue_ads, :issue]
timestamps()
end
def changeset(ad, attrs \\ %{}) do
ad
|> cast(attrs, ~w(url headline story active newsletter delete))
|> cast_attachments(attrs, ~w(image))
|> validate_required([:url, :headline])
|> validate_format(:url, Regexp.http, message: Regexp.http_message)
|> foreign_key_constraint(:sponsorship_id)
|> mark_for_deletion()
end
def active_first(query \\ __MODULE__), do: from(q in query, order_by: [desc: :newsletter, desc: :active])
def preload_all(ad) do
ad
|> preload_issues
|> preload_sponsorship
end
def preload_issues(ad) do
ad
|> Repo.preload(news_issue_ads: {NewsIssueAd.by_position, :issue})
|> Repo.preload(:issues)
end
def preload_sponsorship(query = %Ecto.Query{}), do: Ecto.Query.preload(query, sponsorship: :sponsor)
def preload_sponsorship(ad), do: Repo.preload(ad, sponsorship: :sponsor)
def has_no_issues(ad), do: preload_issues(ad).issues |> Enum.empty?
def track_click(ad) do
ad
|> change(%{click_count: ad.click_count + 1})
|> Repo.update!
ad.sponsorship
|> change(%{click_count: ad.sponsorship.click_count + 1})
|> Repo.update!
end
def track_impression(ad) do
ad
|> change(%{impression_count: ad.impression_count + 1})
|> Repo.update!
ad.sponsorship
|> change(%{impression_count: ad.sponsorship.impression_count + 1})
|> Repo.update!
end
end
| 27.513158 | 107 | 0.684362 |
9e849896ea7d8362075098b135b0e14ccc58adb5 | 2,624 | ex | Elixir | 3-TobogganTrajectory/lib/toboggan_trajectory.ex | dvrensk/advent-of-code-2020 | 237e80da9958f37e51c0ac84da74bec5fec1f185 | [
"Unlicense"
] | 1 | 2020-12-02T01:34:06.000Z | 2020-12-02T01:34:06.000Z | 3-TobogganTrajectory/lib/toboggan_trajectory.ex | dvrensk/advent-of-code-2020 | 237e80da9958f37e51c0ac84da74bec5fec1f185 | [
"Unlicense"
] | null | null | null | 3-TobogganTrajectory/lib/toboggan_trajectory.ex | dvrensk/advent-of-code-2020 | 237e80da9958f37e51c0ac84da74bec5fec1f185 | [
"Unlicense"
] | null | null | null | defmodule TobogganTrajectory do
@moduledoc """
Documentation for `TobogganTrajectory`.
"""
@doc """
iex> forest = TobogganTrajectory.parse_forest(TobogganTrajectory.sample_forest())
iex> TobogganTrajectory.five_slopes_product(forest)
336
"""
def five_slopes_product(forest) do
five_slopes(forest)
|> Enum.reduce(1, fn count, acc -> count * acc end)
end
@doc """
* Right 1, down 1.
* Right 3, down 1. (This is the slope you already checked.)
* Right 5, down 1.
* Right 7, down 1.
* Right 1, down 2.
iex> forest = TobogganTrajectory.parse_forest(TobogganTrajectory.sample_forest())
iex> TobogganTrajectory.five_slopes(forest)
[2, 7, 3, 4, 2]
"""
def five_slopes(forest) do
[
{1, 1},
{3, 1},
{5, 1},
{7, 1},
{1, 2}
]
|> Enum.map(fn {n, m} -> TobogganTrajectory.right_n_down_m(forest, n, m) end)
end
@doc """
iex> forest = TobogganTrajectory.parse_forest(TobogganTrajectory.sample_forest())
iex> forest |> TobogganTrajectory.right_n_down_m(3, 1)
7
iex> forest |> TobogganTrajectory.right_n_down_m(1, 1)
2
iex> forest |> TobogganTrajectory.right_n_down_m(1, 2)
2
iex> forest |> TobogganTrajectory.right_n_down_m(1, 3)
0
"""
def right_n_down_m({_trees, max_row, _max_col} = forest, n, m) do
0..max_row
|> Enum.filter(fn r -> rem(r, m) == 0 end)
|> Enum.count(fn r -> tree?(forest, {r, div(r * n, m)}) end)
end
@doc """
iex> forest = TobogganTrajectory.parse_forest(TobogganTrajectory.sample_forest())
iex> forest |> TobogganTrajectory.tree?({0, 2})
true
iex> forest |> TobogganTrajectory.tree?({4, 12})
true
"""
def tree?({trees, _max_row, max_col}, {r, c}) do
trees[{r, rem(c, max_col + 1)}]
end
@doc """
iex> {trees, max_row, max_col} = TobogganTrajectory.parse_forest(TobogganTrajectory.sample_forest())
iex> max_row
10
iex> max_col
10
iex> trees[{0,0}]
false
iex> trees[{2,6}]
true
"""
def parse_forest(string) do
pairs =
string
|> String.split("\n", trim: true)
|> Enum.with_index()
|> Enum.flat_map(fn {row, r} ->
row
|> String.codepoints()
|> Enum.with_index()
|> Enum.map(fn {square, c} ->
{{r, c}, square == "#"}
end)
end)
trees = Map.new(pairs)
{{r, c}, _} = pairs |> Enum.reverse() |> hd()
{trees, r, c}
end
def sample_forest() do
"""
..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#
"""
end
end
| 23.428571 | 102 | 0.567073 |
9e84c88bbd14e3f6852bda590e50857d2de8b9d3 | 7,712 | ex | Elixir | lib/web/router/impl.ex | ikeyasu/antikythera | 544fdd22e46b1f34177053d87d9e2a9708c74113 | [
"Apache-2.0"
] | null | null | null | lib/web/router/impl.ex | ikeyasu/antikythera | 544fdd22e46b1f34177053d87d9e2a9708c74113 | [
"Apache-2.0"
] | null | null | null | lib/web/router/impl.ex | ikeyasu/antikythera | 544fdd22e46b1f34177053d87d9e2a9708c74113 | [
"Apache-2.0"
] | null | null | null | # Copyright(c) 2015-2018 ACCESS CO., LTD. All rights reserved.
use Croma
defmodule Antikythera.Router.Impl do
@moduledoc """
Internal functions to implement request routing.
"""
alias Antikythera.{Http.Method, PathSegment, PathInfo, Request.PathMatches}
@typep route_entry :: {Method.t, String.t, module, atom, Keyword.t(String.t)}
@typep route_result_success :: {module, atom, PathMatches.t, boolean}
@typep route_result :: nil | route_result_success
defun generate_route_function_clauses(router_module :: v[module], from :: v[:web | :gear], routing_source :: v[[route_entry]]) :: Macro.t do
check_route_definitions(routing_source)
routes_by_method = Enum.group_by(routing_source, fn {method, _, _, _, _} -> method end)
Enum.flat_map(routes_by_method, fn {method, routes} ->
Enum.map(routes, fn {_, path_pattern, controller, action, opts} ->
route_to_clause(router_module, from, method, path_pattern, controller, action, opts)
end)
end) ++ [default_clause(from)]
end
defunp check_route_definitions(routing_source :: [route_entry]) :: :ok do
if !path_names_uniq?(routing_source), do: raise "path names are not unique"
Enum.each(routing_source, fn {_, path_pattern, _, _, _} -> check_path_pattern(path_pattern) end)
end
defunp path_names_uniq?(routing_source :: [route_entry]) :: boolean do
Enum.map(routing_source, fn {_verb, _path, _controller, _action, opts} -> opts[:as] end)
|> Enum.reject(&is_nil/1)
|> unique_list?()
end
defunp unique_list?(l :: [String.t]) :: boolean do
length(l) == length(Enum.uniq(l))
end
defun check_path_pattern(path_pattern :: v[String.t]) :: :ok do
if !String.starts_with?(path_pattern, "/") do
raise "path must start with '/': #{path_pattern}"
end
if byte_size(path_pattern) > 1 and String.ends_with?(path_pattern, "/") do
raise "non-root path must not end with '/': #{path_pattern}"
end
if String.contains?(path_pattern, "//") do
raise "path must not have '//': #{path_pattern}"
end
segments = AntikytheraCore.Handler.GearAction.split_path_to_segments(path_pattern)
if !Enum.all?(segments, &correct_format?/1) do
raise "invalid path format: #{path_pattern}"
end
if !placeholder_names_uniq?(segments) do
raise "path format has duplicated placeholder names: #{path_pattern}"
end
if !wildcard_segment_comes_last?(segments) do
raise "cannot have a wildcard '*' followed by other segments: #{path_pattern}"
end
:ok
end
defunp correct_format?(segment :: v[PathSegment.t]) :: boolean do
Regex.match?(~R/\A(([0-9A-Za-z.~_-]*)|([:*][a-z_][0-9a-z_]*))\z/, segment)
end
defunp placeholder_names_uniq?(segments :: v[PathInfo.t]) :: boolean do
Enum.map(segments, fn
":" <> name -> name
"*" <> name -> name
_ -> nil
end)
|> Enum.reject(&is_nil/1)
|> unique_list?()
end
defunp wildcard_segment_comes_last?(segments :: v[PathInfo.t]) :: boolean do
case Enum.reverse(segments) do
[] -> true
[_last | others] -> Enum.all?(others, &(!String.starts_with?(&1, "*")))
end
end
defunp route_to_clause(router_module :: v[module],
from :: v[:web | :gear],
method :: v[Method.t],
path_pattern :: v[String.t],
controller :: v[module],
action :: v[atom],
opts :: Keyword.t(any)) :: Macro.t do
websocket? = !!opts[:websocket?]
if String.contains?(path_pattern, "/*") do
# For route with wildcard we have to define a slightly modified clause (compared with nowildcard case):
# - `path_info` must be matched with `[... | wildcard]` pattern
# - value of `path_matches` must be `Enum.join`ed
path_info_arg_expr_nowildcard = make_path_info_arg_expr_nowildcard(router_module, path_pattern)
path_info_arg_expr = make_path_info_arg_expr_wildcard(path_info_arg_expr_nowildcard)
path_matches_expr = make_path_matches_expr_wildcard(path_info_arg_expr_nowildcard)
quote do
def unquote(:"__#{from}_route__")(unquote(method), unquote(path_info_arg_expr)) do
Antikythera.Router.Impl.route_clause_body(unquote(controller), unquote(action), unquote(path_matches_expr), unquote(websocket?))
end
end
else
# For each route without wildcard, we define two clauses to match request paths with and without trailing '/'
path_info_arg_expr = make_path_info_arg_expr_nowildcard(router_module, path_pattern)
path_info_arg_expr2 = path_info_arg_expr ++ [""]
path_matches_expr = make_path_matches_expr_nowildcard(path_info_arg_expr)
quote do
def unquote(:"__#{from}_route__")(unquote(method), unquote(path_info_arg_expr)) do
Antikythera.Router.Impl.route_clause_body(unquote(controller), unquote(action), unquote(path_matches_expr), unquote(websocket?))
end
def unquote(:"__#{from}_route__")(unquote(method), unquote(path_info_arg_expr2)) do
Antikythera.Router.Impl.route_clause_body(unquote(controller), unquote(action), unquote(path_matches_expr), unquote(websocket?))
end
end
end
end
defunp default_clause(from :: v[:web | :gear]) :: Macro.t do
quote do
def unquote(:"__#{from}_route__")(_, _) do
nil
end
end
end
defunp make_path_info_arg_expr_nowildcard(router_module :: v[module], path_pattern :: v[String.t]) :: [String.t | Macro.t] do
String.split(path_pattern, "/", trim: true)
|> Enum.map(fn
":" <> placeholder -> Macro.var(String.to_atom(placeholder), router_module) # `String.to_atom` during compilation;
"*" <> placeholder -> Macro.var(String.to_atom(placeholder), router_module) # nothing to worry about
fixed -> fixed
end)
end
defunp make_path_info_arg_expr_wildcard(path_info_arg_expr_nowildcard :: v[[String.t | Macro.t]]) :: Macro.t do
wildcard = List.last(path_info_arg_expr_nowildcard)
case length(path_info_arg_expr_nowildcard) do
1 -> quote do: unquote(wildcard)
len ->
segments = Enum.slice(path_info_arg_expr_nowildcard, 0, len - 2)
before_wildcard = Enum.at(path_info_arg_expr_nowildcard, len - 2)
quote do
# wildcard part must not be an empty list
[unquote_splicing(segments), unquote(before_wildcard) | [_ | _] = unquote(wildcard)]
end
end
end
defunp make_path_matches_expr_nowildcard(path_info_arg_expr :: v[[String.t | Macro.t]]) :: Keyword.t(Macro.t) do
Enum.map(path_info_arg_expr, fn
{name, _, _} = v -> {name, v}
_ -> nil
end)
|> Enum.reject(&is_nil/1)
end
defunp make_path_matches_expr_wildcard(path_info_arg_expr_nowildcard :: v[[String.t | Macro.t]]) :: Keyword.t(Macro.t) do
{name, _, _} = var = List.last(path_info_arg_expr_nowildcard)
wildcard_pair = {name, quote do: Enum.join(unquote(var), "/")}
path_matches_expr_without_last =
Enum.slice(path_info_arg_expr_nowildcard, 0, length(path_info_arg_expr_nowildcard) - 1) |> make_path_matches_expr_nowildcard
path_matches_expr_without_last ++ [wildcard_pair]
end
defun route_clause_body(controller :: v[module], action :: v[atom], path_matches :: Keyword.t(String.t), websocket? :: v[boolean]) :: route_result do
if Enum.all?(path_matches, fn {_placeholder, match} -> String.printable?(match) end) do
{controller, action, Map.new(path_matches), websocket?}
else
nil
end
end
end
| 43.818182 | 151 | 0.661696 |
9e84d2d76d4328c24104170c87447dff51052b48 | 472 | ex | Elixir | throwaway/hello/deps/postgrex/lib/postgrex/extensions/raw.ex | BryanJBryce/programming-phoenix | ced3b5c383ada2575237d377430ef0a2743da0a2 | [
"MIT"
] | 1 | 2016-08-17T11:39:26.000Z | 2016-08-17T11:39:26.000Z | deps/postgrex/lib/postgrex/extensions/raw.ex | superbogy/pande | 30ebb683febd1cd10711e562863fc73b87827c53 | [
"MIT"
] | null | null | null | deps/postgrex/lib/postgrex/extensions/raw.ex | superbogy/pande | 30ebb683febd1cd10711e562863fc73b87827c53 | [
"MIT"
] | null | null | null | defmodule Postgrex.Extensions.Raw do
@moduledoc false
use Postgrex.BinaryExtension,
[send: "bpcharsend", send: "textsend", send: "varcharsend",
send: "byteasend", send: "enum_send", send: "unknownsend",
type: "citext"]
def encode(_, bin, _, _) when is_binary(bin),
do: bin
def encode(type_info, value, _, _) do
raise ArgumentError, Postgrex.Utils.encode_msg(type_info, value, "a binary")
end
def decode(_, bin, _, _),
do: bin
end
| 27.764706 | 80 | 0.667373 |
9e84fc01498ef71fb36695473de240a1b88838c4 | 12,562 | ex | Elixir | apps/language_server/lib/language_server/providers/execute_command/manipulate_pipes.ex | lucacervello/elixir-ls | 6a786d7d9e7ca97a2c9c77ea4acd0057a98734d8 | [
"Apache-2.0"
] | null | null | null | apps/language_server/lib/language_server/providers/execute_command/manipulate_pipes.ex | lucacervello/elixir-ls | 6a786d7d9e7ca97a2c9c77ea4acd0057a98734d8 | [
"Apache-2.0"
] | null | null | null | apps/language_server/lib/language_server/providers/execute_command/manipulate_pipes.ex | lucacervello/elixir-ls | 6a786d7d9e7ca97a2c9c77ea4acd0057a98734d8 | [
"Apache-2.0"
] | null | null | null | defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.ManipulatePipes do
@moduledoc """
This module implements a custom command for converting function calls
to pipe operators and pipes to function calls.
Returns a formatted source fragment.
"""
import ElixirLS.LanguageServer.Protocol
alias ElixirLS.LanguageServer.{JsonRpc, Server}
alias ElixirLS.LanguageServer.SourceFile
alias ElixirLS.LanguageServer.Protocol.TextEdit
alias __MODULE__.AST
@behaviour ElixirLS.LanguageServer.Providers.ExecuteCommand
@newlines ["\r\n", "\n", "\r"]
@impl ElixirLS.LanguageServer.Providers.ExecuteCommand
def execute([operation, uri, line, col], state)
when is_integer(line) and is_integer(col) and is_binary(uri) and
operation in ["toPipe", "fromPipe"] do
# line and col are assumed to be 0-indexed
source_file = Server.get_source_file(state, uri)
label =
case operation do
"toPipe" -> "Convert function call to pipe operator"
"fromPipe" -> "Convert pipe operator to function call"
end
processing_result =
case operation do
"toPipe" ->
to_pipe_at_cursor(source_file.text, line, col)
"fromPipe" ->
from_pipe_at_cursor(source_file.text, line, col)
end
with {:ok, %TextEdit{} = text_edit} <- processing_result,
{:ok, %{"applied" => true}} <-
JsonRpc.send_request("workspace/applyEdit", %{
"label" => label,
"edit" => %{
"changes" => %{
uri => [text_edit]
}
}
}) do
{:ok, nil}
else
{:error, reason} ->
{:error, reason}
error ->
{:error, :server_error,
"cannot execute pipe conversion, workspace/applyEdit returned #{inspect(error)}"}
end
end
@doc false
def to_pipe_at_cursor(text, line, col) do
result =
ElixirSense.Core.Source.walk_text(
text,
%{walked_text: "", function_call: nil, range: nil},
fn current_char, remaining_text, current_line, current_col, acc ->
if current_line - 1 == line and current_col - 1 == col do
{:ok, function_call, call_range} =
get_function_call(line, col, acc.walked_text, current_char, remaining_text)
if function_call_includes_cursor(call_range, line, col) do
{remaining_text,
%{
acc
| walked_text: acc.walked_text <> current_char,
function_call: function_call,
range: call_range
}}
else
# The cursor was not inside a function call so we cannot
# manipulate the pipes
{remaining_text,
%{
acc
| walked_text: acc.walked_text <> current_char
}}
end
else
{remaining_text, %{acc | walked_text: acc.walked_text <> current_char}}
end
end
)
with {:result, %{function_call: function_call, range: range}}
when not is_nil(function_call) and not is_nil(range) <- {:result, result},
{:ok, piped_text} <- AST.to_pipe(function_call) do
text_edit = %TextEdit{newText: piped_text, range: range}
{:ok, text_edit}
else
{:result, %{function_call: nil}} ->
{:error, :function_call_not_found}
{:error, :invalid_code} ->
{:error, :invalid_code}
end
end
defp from_pipe_at_cursor(text, line, col) do
result =
ElixirSense.Core.Source.walk_text(
text,
%{walked_text: "", pipe_call: nil, range: nil},
fn current_char, remaining_text, current_line, current_col, acc ->
if current_line - 1 == line and current_col - 1 == col do
case get_pipe_call(line, col, acc.walked_text, current_char, remaining_text) do
{:ok, pipe_call, call_range} ->
{remaining_text,
%{
acc
| walked_text: acc.walked_text <> current_char,
pipe_call: pipe_call,
range: call_range
}}
{:error, :no_pipe_at_selection} ->
{remaining_text,
%{
acc
| walked_text: acc.walked_text <> current_char
}}
end
else
{remaining_text, %{acc | walked_text: acc.walked_text <> current_char}}
end
end
)
with {:result, %{pipe_call: pipe_call, range: range}}
when not is_nil(pipe_call) and not is_nil(range) <- {:result, result},
{:ok, unpiped_text} <- AST.from_pipe(pipe_call) do
text_edit = %TextEdit{newText: unpiped_text, range: range}
{:ok, text_edit}
else
{:result, %{pipe_call: nil}} ->
{:error, :pipe_not_found}
{:error, :invalid_code} ->
{:error, :invalid_code}
end
end
defp get_function_call(line, col, head, cur, original_tail) when cur in ["\n", "\r", "\r\n"] do
{head, new_cur} = String.split_at(head, -1)
get_function_call(line, col - 1, head, new_cur, cur <> original_tail)
end
defp get_function_call(line, col, head, ")", original_tail) do
{head, cur} = String.split_at(head, -1)
get_function_call(line, col - 1, head, cur, ")" <> original_tail)
end
defp get_function_call(line, col, head, current, original_tail) do
tail = do_get_function_call(original_tail, "(", ")")
{end_line, end_col} =
if String.contains?(tail, @newlines) do
tail_list = String.split(tail, @newlines)
end_line = line + length(tail_list) - 1
end_col = tail_list |> Enum.at(-1) |> String.length()
{end_line, end_col}
else
{line, col + String.length(tail) + 1}
end
text = head <> current <> tail
call = get_function_call_before(text)
orig_head = head
{head, _new_tail} =
case String.length(tail) do
0 -> {call, ""}
length -> String.split_at(call, -length)
end
{line, col} = fix_start_of_range(orig_head, head, line, col)
{:ok, call, range(line, col, end_line, end_col)}
end
defp do_get_function_call(text, start_char, end_char) do
text
|> do_get_function_call(start_char, end_char, %{paren_count: 0, text: ""})
|> Map.get(:text)
|> IO.iodata_to_binary()
end
defp do_get_function_call(<<c::binary-size(1), tail::bitstring>>, start_char, end_char, acc)
when c == start_char do
do_get_function_call(tail, start_char, end_char, %{
acc
| paren_count: acc.paren_count + 1,
text: [acc.text | [c]]
})
end
defp do_get_function_call(<<c::binary-size(1), tail::bitstring>>, start_char, end_char, acc)
when c == end_char do
acc = %{acc | paren_count: acc.paren_count - 1, text: [acc.text | [c]]}
if acc.paren_count <= 0 do
acc
else
do_get_function_call(tail, start_char, end_char, acc)
end
end
defp do_get_function_call(<<c::binary-size(1), tail::bitstring>>, start_char, end_char, acc) do
do_get_function_call(tail, start_char, end_char, %{acc | text: [acc.text | [c]]})
end
defp do_get_function_call(_, _, _, acc), do: acc
defp get_pipe_call(line, col, head, current, tail) do
pipe_right = do_get_function_call(tail, "(", ")")
pipe_left =
head
|> String.reverse()
|> :unicode.characters_to_binary(:utf8, :utf16)
|> do_get_pipe_call()
|> :unicode.characters_to_binary(:utf16, :utf8)
pipe_left =
if String.contains?(pipe_left, ")") do
get_function_call_before(head)
else
pipe_left
end
pipe_left = String.trim_leading(pipe_left)
pipe_call = pipe_left <> current <> pipe_right
{line_offset, tail_length} =
pipe_left
|> String.reverse()
|> count_newlines_and_get_tail()
start_line = line - line_offset
start_col =
if line_offset != 0 do
head
|> String.trim_trailing(pipe_left)
|> String.split(["\r\n", "\n", "\r"])
|> Enum.at(-1, "")
|> String.length()
else
col - tail_length
end
{line_offset, tail_length} = (current <> pipe_right) |> count_newlines_and_get_tail()
end_line = line + line_offset
end_col =
if line_offset != 0 do
tail_length
else
col + tail_length
end
if String.contains?(pipe_call, "|>") do
{:ok, pipe_call, range(start_line, start_col, end_line, end_col)}
else
{:error, :no_pipe_at_selection}
end
end
# do_get_pipe_call(text :: utf16 binary, {utf16 binary, has_passed_through_whitespace, should_halt})
defp do_get_pipe_call(text, acc \\ {"", false, false})
defp do_get_pipe_call(_text, {acc, _, true}), do: acc
defp do_get_pipe_call("", {acc, _, _}), do: acc
defp do_get_pipe_call(<<?\r::utf16, ?\n::utf16, _::bitstring>>, {acc, true, _}),
do: <<?\r::utf16, ?\n::utf16, acc::bitstring>>
defp do_get_pipe_call(<<0, c::utf8, _::bitstring>>, {acc, true, _})
when c in [?\t, ?\v, ?\r, ?\n, ?\s],
do: <<c::utf16, acc::bitstring>>
defp do_get_pipe_call(<<0, ?\r, 0, ?\n, text::bitstring>>, {acc, false, _}),
do: do_get_pipe_call(text, {<<?\r::utf16, ?\n::utf16, acc::bitstring>>, false, false})
defp do_get_pipe_call(<<0, c::utf8, text::bitstring>>, {acc, false, _})
when c in [?\t, ?\v, ?\n, ?\s],
do: do_get_pipe_call(text, {<<c::utf16, acc::bitstring>>, false, false})
defp do_get_pipe_call(<<0, c::utf8, text::bitstring>>, {acc, _, _})
when c in [?|, ?>],
do: do_get_pipe_call(text, {<<c::utf16, acc::bitstring>>, false, false})
defp do_get_pipe_call(<<c::utf16, text::bitstring>>, {acc, _, _}),
do: do_get_pipe_call(text, {<<c::utf16, acc::bitstring>>, true, false})
defp get_function_call_before(head) do
call_without_function_name =
head
|> String.reverse()
|> do_get_function_call(")", "(")
|> String.reverse()
if call_without_function_name == "" do
head
else
function_name =
head
|> String.trim_trailing(call_without_function_name)
|> get_function_name_from_tail()
function_name <> call_without_function_name
end
end
defp get_function_name_from_tail(s) do
s
|> String.reverse()
|> String.graphemes()
|> Enum.reduce_while([], fn c, acc ->
if String.match?(c, ~r/[\s\(\[\{]/) do
{:halt, acc}
else
{:cont, [c | acc]}
end
end)
|> IO.iodata_to_binary()
end
defp count_newlines_and_get_tail(s, acc \\ {0, 0})
defp count_newlines_and_get_tail("", acc), do: acc
defp count_newlines_and_get_tail(s, {line_count, tail_length}) do
case String.next_grapheme(s) do
{g, tail} when g in ["\r\n", "\r", "\n"] ->
count_newlines_and_get_tail(tail, {line_count + 1, 0})
{_, tail} ->
count_newlines_and_get_tail(tail, {line_count, tail_length + 1})
end
end
# Fixes the line and column returned, finding the correct position on previous lines
defp fix_start_of_range(orig_head, head, line, col)
defp fix_start_of_range(_, "", line, col), do: {line, col + 2}
defp fix_start_of_range(orig_head, head, line, col) do
new_col = col - String.length(head) + 1
if new_col < 0 do
lines =
SourceFile.lines(orig_head)
|> Enum.take(line)
|> Enum.reverse()
# Go back through previous lines to find the correctly adjusted line and
# column number for the start of head (where the function starts)
Enum.reduce_while(lines, {line, new_col}, fn
_line_text, {cur_line, cur_col} when cur_col >= 0 ->
{:halt, {cur_line, cur_col}}
line_text, {cur_line, cur_col} ->
# The +1 is for the line separator
{:cont, {cur_line - 1, cur_col + String.length(line_text) + 1}}
end)
else
{line, new_col}
end
end
defp function_call_includes_cursor(call_range, line, char) do
range(start_line, start_character, end_line, end_character) = call_range
starts_before =
cond do
start_line < line -> true
start_line == line and start_character <= char -> true
true -> false
end
ends_after =
cond do
end_line > line -> true
end_line == line and end_character >= char -> true
true -> false
end
starts_before and ends_after
end
end
| 30.940887 | 102 | 0.596004 |
9e84fd3932e1290d0d184da9e677cd159acb42c7 | 46,036 | ex | Elixir | lib/aws/generated/iot_site_wise.ex | qyon-brazil/aws-elixir | f7f21bebffc6776f95ffe9ef563cf368773438af | [
"Apache-2.0"
] | null | null | null | lib/aws/generated/iot_site_wise.ex | qyon-brazil/aws-elixir | f7f21bebffc6776f95ffe9ef563cf368773438af | [
"Apache-2.0"
] | null | null | null | lib/aws/generated/iot_site_wise.ex | qyon-brazil/aws-elixir | f7f21bebffc6776f95ffe9ef563cf368773438af | [
"Apache-2.0"
] | 1 | 2020-10-28T08:56:54.000Z | 2020-10-28T08:56:54.000Z | # WARNING: DO NOT EDIT, AUTO-GENERATED CODE!
# See https://github.com/aws-beam/aws-codegen for more details.
defmodule AWS.IoTSiteWise do
@moduledoc """
Welcome to the AWS IoT SiteWise API Reference.
AWS IoT SiteWise is an AWS service that connects [Industrial Internet of Things (IIoT)](https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications)
devices to the power of the AWS Cloud. For more information, see the [AWS IoT SiteWise User
Guide](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/). For
information about AWS IoT SiteWise quotas, see
[Quotas](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html)
in the *AWS IoT SiteWise User Guide*.
"""
alias AWS.Client
alias AWS.Request
def metadata do
%AWS.ServiceMetadata{
abbreviation: nil,
api_version: "2019-12-02",
content_type: "application/x-amz-json-1.1",
credential_scope: nil,
endpoint_prefix: "iotsitewise",
global?: false,
protocol: "rest-json",
service_id: "IoTSiteWise",
signature_version: "v4",
signing_name: "iotsitewise",
target_prefix: nil
}
end
@doc """
Associates a child asset with the given parent asset through a hierarchy defined
in the parent asset's model.
For more information, see [Associating assets](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/add-associated-assets.html)
in the *AWS IoT SiteWise User Guide*.
"""
def associate_assets(%Client{} = client, asset_id, input, options \\ []) do
url_path = "/assets/#{URI.encode(asset_id)}/associate"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Associates a group (batch) of assets with an AWS IoT SiteWise Monitor project.
"""
def batch_associate_project_assets(%Client{} = client, project_id, input, options \\ []) do
url_path = "/projects/#{URI.encode(project_id)}/assets/associate"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
200
)
end
@doc """
Disassociates a group (batch) of assets from an AWS IoT SiteWise Monitor
project.
"""
def batch_disassociate_project_assets(%Client{} = client, project_id, input, options \\ []) do
url_path = "/projects/#{URI.encode(project_id)}/assets/disassociate"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
200
)
end
@doc """
Sends a list of asset property values to AWS IoT SiteWise.
Each value is a timestamp-quality-value (TQV) data point. For more information,
see [Ingesting data using the API](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/ingest-api.html)
in the *AWS IoT SiteWise User Guide*.
To identify an asset property, you must specify one of the following:
* The `assetId` and `propertyId` of an asset property.
* A `propertyAlias`, which is a data stream alias (for example,
`/company/windfarm/3/turbine/7/temperature`). To define an asset property's
alias, see
[UpdateAssetProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetProperty.html).
With respect to Unix epoch time, AWS IoT SiteWise accepts only TQVs that have a
timestamp of no more than 7 days in the past and no more than 5 minutes in the
future. AWS IoT SiteWise rejects timestamps outside of the inclusive range of
[-7 days, +5 minutes] and returns a `TimestampOutOfRangeException` error.
For each asset property, AWS IoT SiteWise overwrites TQVs with duplicate
timestamps unless the newer TQV has a different quality. For example, if you
store a TQV `{T1, GOOD, V1}`, then storing `{T1, GOOD, V2}` replaces the
existing TQV.
AWS IoT SiteWise authorizes access to each `BatchPutAssetPropertyValue` entry
individually. For more information, see [BatchPutAssetPropertyValue authorization](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/security_iam_service-with-iam.html#security_iam_service-with-iam-id-based-policies-batchputassetpropertyvalue-action)
in the *AWS IoT SiteWise User Guide*.
"""
def batch_put_asset_property_value(%Client{} = client, input, options \\ []) do
url_path = "/properties"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Creates an access policy that grants the specified identity (AWS SSO user, AWS
SSO group, or IAM user) access to the specified AWS IoT SiteWise Monitor portal
or project resource.
"""
def create_access_policy(%Client{} = client, input, options \\ []) do
url_path = "/access-policies"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
201
)
end
@doc """
Creates an asset from an existing asset model.
For more information, see [Creating assets](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/create-assets.html)
in the *AWS IoT SiteWise User Guide*.
"""
def create_asset(%Client{} = client, input, options \\ []) do
url_path = "/assets"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Creates an asset model from specified property and hierarchy definitions.
You create assets from asset models. With asset models, you can easily create
assets of the same type that have standardized definitions. Each asset created
from a model inherits the asset model's property and hierarchy definitions. For
more information, see [Defining asset models](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/define-models.html)
in the *AWS IoT SiteWise User Guide*.
"""
def create_asset_model(%Client{} = client, input, options \\ []) do
url_path = "/asset-models"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Creates a dashboard in an AWS IoT SiteWise Monitor project.
"""
def create_dashboard(%Client{} = client, input, options \\ []) do
url_path = "/dashboards"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
201
)
end
@doc """
Creates a gateway, which is a virtual or edge device that delivers industrial
data streams from local servers to AWS IoT SiteWise.
For more information, see [Ingesting data using a gateway](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/gateway-connector.html)
in the *AWS IoT SiteWise User Guide*.
"""
def create_gateway(%Client{} = client, input, options \\ []) do
url_path = "/20200301/gateways"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
201
)
end
@doc """
Creates a portal, which can contain projects and dashboards.
AWS IoT SiteWise Monitor uses AWS SSO or IAM to authenticate portal users and
manage user permissions.
Before you can sign in to a new portal, you must add at least one identity to
that portal. For more information, see [Adding or removing portal administrators](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html#portal-change-admins)
in the *AWS IoT SiteWise User Guide*.
"""
def create_portal(%Client{} = client, input, options \\ []) do
url_path = "/portals"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Creates a project in the specified portal.
"""
def create_project(%Client{} = client, input, options \\ []) do
url_path = "/projects"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
201
)
end
@doc """
Deletes an access policy that grants the specified identity access to the
specified AWS IoT SiteWise Monitor resource.
You can use this operation to revoke access to an AWS IoT SiteWise Monitor
resource.
"""
def delete_access_policy(%Client{} = client, access_policy_id, input, options \\ []) do
url_path = "/access-policies/#{URI.encode(access_policy_id)}"
headers = []
{query_params, input} =
[
{"clientToken", "clientToken"}
]
|> Request.build_params(input)
Request.request_rest(
client,
metadata(),
:delete,
url_path,
query_params,
headers,
input,
options,
204
)
end
@doc """
Deletes an asset.
This action can't be undone. For more information, see [Deleting assets and models](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/delete-assets-and-models.html)
in the *AWS IoT SiteWise User Guide*.
You can't delete an asset that's associated to another asset. For more
information, see
[DisassociateAssets](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DisassociateAssets.html).
"""
def delete_asset(%Client{} = client, asset_id, input, options \\ []) do
url_path = "/assets/#{URI.encode(asset_id)}"
headers = []
{query_params, input} =
[
{"clientToken", "clientToken"}
]
|> Request.build_params(input)
Request.request_rest(
client,
metadata(),
:delete,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Deletes an asset model.
This action can't be undone. You must delete all assets created from an asset
model before you can delete the model. Also, you can't delete an asset model if
a parent asset model exists that contains a property formula expression that
depends on the asset model that you want to delete. For more information, see
[Deleting assets and models](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/delete-assets-and-models.html)
in the *AWS IoT SiteWise User Guide*.
"""
def delete_asset_model(%Client{} = client, asset_model_id, input, options \\ []) do
url_path = "/asset-models/#{URI.encode(asset_model_id)}"
headers = []
{query_params, input} =
[
{"clientToken", "clientToken"}
]
|> Request.build_params(input)
Request.request_rest(
client,
metadata(),
:delete,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Deletes a dashboard from AWS IoT SiteWise Monitor.
"""
def delete_dashboard(%Client{} = client, dashboard_id, input, options \\ []) do
url_path = "/dashboards/#{URI.encode(dashboard_id)}"
headers = []
{query_params, input} =
[
{"clientToken", "clientToken"}
]
|> Request.build_params(input)
Request.request_rest(
client,
metadata(),
:delete,
url_path,
query_params,
headers,
input,
options,
204
)
end
@doc """
Deletes a gateway from AWS IoT SiteWise.
When you delete a gateway, some of the gateway's files remain in your gateway's
file system.
"""
def delete_gateway(%Client{} = client, gateway_id, input, options \\ []) do
url_path = "/20200301/gateways/#{URI.encode(gateway_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:delete,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Deletes a portal from AWS IoT SiteWise Monitor.
"""
def delete_portal(%Client{} = client, portal_id, input, options \\ []) do
url_path = "/portals/#{URI.encode(portal_id)}"
headers = []
{query_params, input} =
[
{"clientToken", "clientToken"}
]
|> Request.build_params(input)
Request.request_rest(
client,
metadata(),
:delete,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Deletes a project from AWS IoT SiteWise Monitor.
"""
def delete_project(%Client{} = client, project_id, input, options \\ []) do
url_path = "/projects/#{URI.encode(project_id)}"
headers = []
{query_params, input} =
[
{"clientToken", "clientToken"}
]
|> Request.build_params(input)
Request.request_rest(
client,
metadata(),
:delete,
url_path,
query_params,
headers,
input,
options,
204
)
end
@doc """
Describes an access policy, which specifies an identity's access to an AWS IoT
SiteWise Monitor portal or project.
"""
def describe_access_policy(%Client{} = client, access_policy_id, options \\ []) do
url_path = "/access-policies/#{URI.encode(access_policy_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Retrieves information about an asset.
"""
def describe_asset(%Client{} = client, asset_id, options \\ []) do
url_path = "/assets/#{URI.encode(asset_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves information about an asset model.
"""
def describe_asset_model(%Client{} = client, asset_model_id, options \\ []) do
url_path = "/asset-models/#{URI.encode(asset_model_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves information about an asset property.
When you call this operation for an attribute property, this response includes
the default attribute value that you define in the asset model. If you update
the default value in the model, this operation's response includes the new
default value.
This operation doesn't return the value of the asset property. To get the value
of an asset property, use
[GetAssetPropertyValue](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_GetAssetPropertyValue.html).
"""
def describe_asset_property(%Client{} = client, asset_id, property_id, options \\ []) do
url_path = "/assets/#{URI.encode(asset_id)}/properties/#{URI.encode(property_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves information about a dashboard.
"""
def describe_dashboard(%Client{} = client, dashboard_id, options \\ []) do
url_path = "/dashboards/#{URI.encode(dashboard_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Retrieves information about the default encryption configuration for the AWS
account in the default or specified region.
For more information, see [Key management](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/key-management.html)
in the *AWS IoT SiteWise User Guide*.
"""
def describe_default_encryption_configuration(%Client{} = client, options \\ []) do
url_path = "/configuration/account/encryption"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves information about a gateway.
"""
def describe_gateway(%Client{} = client, gateway_id, options \\ []) do
url_path = "/20200301/gateways/#{URI.encode(gateway_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves information about a gateway capability configuration.
Each gateway capability defines data sources for a gateway. A capability
configuration can contain multiple data source configurations. If you define
OPC-UA sources for a gateway in the AWS IoT SiteWise console, all of your OPC-UA
sources are stored in one capability configuration. To list all capability
configurations for a gateway, use
[DescribeGateway](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGateway.html).
"""
def describe_gateway_capability_configuration(
%Client{} = client,
capability_namespace,
gateway_id,
options \\ []
) do
url_path =
"/20200301/gateways/#{URI.encode(gateway_id)}/capability/#{URI.encode(capability_namespace)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves the current AWS IoT SiteWise logging options.
"""
def describe_logging_options(%Client{} = client, options \\ []) do
url_path = "/logging"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves information about a portal.
"""
def describe_portal(%Client{} = client, portal_id, options \\ []) do
url_path = "/portals/#{URI.encode(portal_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Retrieves information about a project.
"""
def describe_project(%Client{} = client, project_id, options \\ []) do
url_path = "/projects/#{URI.encode(project_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Disassociates a child asset from the given parent asset through a hierarchy
defined in the parent asset's model.
"""
def disassociate_assets(%Client{} = client, asset_id, input, options \\ []) do
url_path = "/assets/#{URI.encode(asset_id)}/disassociate"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Gets aggregated values for an asset property.
For more information, see [Querying aggregates](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#aggregates)
in the *AWS IoT SiteWise User Guide*.
To identify an asset property, you must specify one of the following:
* The `assetId` and `propertyId` of an asset property.
* A `propertyAlias`, which is a data stream alias (for example,
`/company/windfarm/3/turbine/7/temperature`). To define an asset property's
alias, see
[UpdateAssetProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetProperty.html).
"""
def get_asset_property_aggregates(
%Client{} = client,
aggregate_types,
asset_id \\ nil,
end_date,
max_results \\ nil,
next_token \\ nil,
property_alias \\ nil,
property_id \\ nil,
qualities \\ nil,
resolution,
start_date,
time_ordering \\ nil,
options \\ []
) do
url_path = "/properties/aggregates"
headers = []
query_params = []
query_params =
if !is_nil(time_ordering) do
[{"timeOrdering", time_ordering} | query_params]
else
query_params
end
query_params =
if !is_nil(start_date) do
[{"startDate", start_date} | query_params]
else
query_params
end
query_params =
if !is_nil(resolution) do
[{"resolution", resolution} | query_params]
else
query_params
end
query_params =
if !is_nil(qualities) do
[{"qualities", qualities} | query_params]
else
query_params
end
query_params =
if !is_nil(property_id) do
[{"propertyId", property_id} | query_params]
else
query_params
end
query_params =
if !is_nil(property_alias) do
[{"propertyAlias", property_alias} | query_params]
else
query_params
end
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
query_params =
if !is_nil(end_date) do
[{"endDate", end_date} | query_params]
else
query_params
end
query_params =
if !is_nil(asset_id) do
[{"assetId", asset_id} | query_params]
else
query_params
end
query_params =
if !is_nil(aggregate_types) do
[{"aggregateTypes", aggregate_types} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Gets an asset property's current value.
For more information, see [Querying current values](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#current-values)
in the *AWS IoT SiteWise User Guide*.
To identify an asset property, you must specify one of the following:
* The `assetId` and `propertyId` of an asset property.
* A `propertyAlias`, which is a data stream alias (for example,
`/company/windfarm/3/turbine/7/temperature`). To define an asset property's
alias, see
[UpdateAssetProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetProperty.html).
"""
def get_asset_property_value(
%Client{} = client,
asset_id \\ nil,
property_alias \\ nil,
property_id \\ nil,
options \\ []
) do
url_path = "/properties/latest"
headers = []
query_params = []
query_params =
if !is_nil(property_id) do
[{"propertyId", property_id} | query_params]
else
query_params
end
query_params =
if !is_nil(property_alias) do
[{"propertyAlias", property_alias} | query_params]
else
query_params
end
query_params =
if !is_nil(asset_id) do
[{"assetId", asset_id} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Gets the history of an asset property's values.
For more information, see [Querying historical values](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#historical-values)
in the *AWS IoT SiteWise User Guide*.
To identify an asset property, you must specify one of the following:
* The `assetId` and `propertyId` of an asset property.
* A `propertyAlias`, which is a data stream alias (for example,
`/company/windfarm/3/turbine/7/temperature`). To define an asset property's
alias, see
[UpdateAssetProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetProperty.html).
"""
def get_asset_property_value_history(
%Client{} = client,
asset_id \\ nil,
end_date \\ nil,
max_results \\ nil,
next_token \\ nil,
property_alias \\ nil,
property_id \\ nil,
qualities \\ nil,
start_date \\ nil,
time_ordering \\ nil,
options \\ []
) do
url_path = "/properties/history"
headers = []
query_params = []
query_params =
if !is_nil(time_ordering) do
[{"timeOrdering", time_ordering} | query_params]
else
query_params
end
query_params =
if !is_nil(start_date) do
[{"startDate", start_date} | query_params]
else
query_params
end
query_params =
if !is_nil(qualities) do
[{"qualities", qualities} | query_params]
else
query_params
end
query_params =
if !is_nil(property_id) do
[{"propertyId", property_id} | query_params]
else
query_params
end
query_params =
if !is_nil(property_alias) do
[{"propertyAlias", property_alias} | query_params]
else
query_params
end
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
query_params =
if !is_nil(end_date) do
[{"endDate", end_date} | query_params]
else
query_params
end
query_params =
if !is_nil(asset_id) do
[{"assetId", asset_id} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves a paginated list of access policies for an identity (an AWS SSO user,
an AWS SSO group, or an IAM user) or an AWS IoT SiteWise Monitor resource (a
portal or project).
"""
def list_access_policies(
%Client{} = client,
iam_arn \\ nil,
identity_id \\ nil,
identity_type \\ nil,
max_results \\ nil,
next_token \\ nil,
resource_id \\ nil,
resource_type \\ nil,
options \\ []
) do
url_path = "/access-policies"
headers = []
query_params = []
query_params =
if !is_nil(resource_type) do
[{"resourceType", resource_type} | query_params]
else
query_params
end
query_params =
if !is_nil(resource_id) do
[{"resourceId", resource_id} | query_params]
else
query_params
end
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
query_params =
if !is_nil(identity_type) do
[{"identityType", identity_type} | query_params]
else
query_params
end
query_params =
if !is_nil(identity_id) do
[{"identityId", identity_id} | query_params]
else
query_params
end
query_params =
if !is_nil(iam_arn) do
[{"iamArn", iam_arn} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Retrieves a paginated list of summaries of all asset models.
"""
def list_asset_models(%Client{} = client, max_results \\ nil, next_token \\ nil, options \\ []) do
url_path = "/asset-models"
headers = []
query_params = []
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves a paginated list of asset relationships for an asset.
You can use this operation to identify an asset's root asset and all associated
assets between that asset and its root.
"""
def list_asset_relationships(
%Client{} = client,
asset_id,
max_results \\ nil,
next_token \\ nil,
traversal_type,
options \\ []
) do
url_path = "/assets/#{URI.encode(asset_id)}/assetRelationships"
headers = []
query_params = []
query_params =
if !is_nil(traversal_type) do
[{"traversalType", traversal_type} | query_params]
else
query_params
end
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves a paginated list of asset summaries.
You can use this operation to do the following:
* List assets based on a specific asset model.
* List top-level assets.
You can't use this operation to list all assets. To retrieve summaries for all
of your assets, use
[ListAssetModels](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_ListAssetModels.html)
to get all of your asset model IDs. Then, use ListAssets to get all assets for
each asset model.
"""
def list_assets(
%Client{} = client,
asset_model_id \\ nil,
filter \\ nil,
max_results \\ nil,
next_token \\ nil,
options \\ []
) do
url_path = "/assets"
headers = []
query_params = []
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
query_params =
if !is_nil(filter) do
[{"filter", filter} | query_params]
else
query_params
end
query_params =
if !is_nil(asset_model_id) do
[{"assetModelId", asset_model_id} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves a paginated list of associated assets.
You can use this operation to do the following:
* List child assets associated to a parent asset by a hierarchy that
you specify.
* List an asset's parent asset.
"""
def list_associated_assets(
%Client{} = client,
asset_id,
hierarchy_id \\ nil,
max_results \\ nil,
next_token \\ nil,
traversal_direction \\ nil,
options \\ []
) do
url_path = "/assets/#{URI.encode(asset_id)}/hierarchies"
headers = []
query_params = []
query_params =
if !is_nil(traversal_direction) do
[{"traversalDirection", traversal_direction} | query_params]
else
query_params
end
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
query_params =
if !is_nil(hierarchy_id) do
[{"hierarchyId", hierarchy_id} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves a paginated list of dashboards for an AWS IoT SiteWise Monitor
project.
"""
def list_dashboards(
%Client{} = client,
max_results \\ nil,
next_token \\ nil,
project_id,
options \\ []
) do
url_path = "/dashboards"
headers = []
query_params = []
query_params =
if !is_nil(project_id) do
[{"projectId", project_id} | query_params]
else
query_params
end
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Retrieves a paginated list of gateways.
"""
def list_gateways(%Client{} = client, max_results \\ nil, next_token \\ nil, options \\ []) do
url_path = "/20200301/gateways"
headers = []
query_params = []
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Retrieves a paginated list of AWS IoT SiteWise Monitor portals.
"""
def list_portals(%Client{} = client, max_results \\ nil, next_token \\ nil, options \\ []) do
url_path = "/portals"
headers = []
query_params = []
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Retrieves a paginated list of assets associated with an AWS IoT SiteWise Monitor
project.
"""
def list_project_assets(
%Client{} = client,
project_id,
max_results \\ nil,
next_token \\ nil,
options \\ []
) do
url_path = "/projects/#{URI.encode(project_id)}/assets"
headers = []
query_params = []
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Retrieves a paginated list of projects for an AWS IoT SiteWise Monitor portal.
"""
def list_projects(
%Client{} = client,
max_results \\ nil,
next_token \\ nil,
portal_id,
options \\ []
) do
url_path = "/projects"
headers = []
query_params = []
query_params =
if !is_nil(portal_id) do
[{"portalId", portal_id} | query_params]
else
query_params
end
query_params =
if !is_nil(next_token) do
[{"nextToken", next_token} | query_params]
else
query_params
end
query_params =
if !is_nil(max_results) do
[{"maxResults", max_results} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
200
)
end
@doc """
Retrieves the list of tags for an AWS IoT SiteWise resource.
"""
def list_tags_for_resource(%Client{} = client, resource_arn, options \\ []) do
url_path = "/tags"
headers = []
query_params = []
query_params =
if !is_nil(resource_arn) do
[{"resourceArn", resource_arn} | query_params]
else
query_params
end
Request.request_rest(
client,
metadata(),
:get,
url_path,
query_params,
headers,
nil,
options,
nil
)
end
@doc """
Sets the default encryption configuration for the AWS account.
For more information, see [Key management](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/key-management.html)
in the *AWS IoT SiteWise User Guide*.
"""
def put_default_encryption_configuration(%Client{} = client, input, options \\ []) do
url_path = "/configuration/account/encryption"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Sets logging options for AWS IoT SiteWise.
"""
def put_logging_options(%Client{} = client, input, options \\ []) do
url_path = "/logging"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Adds tags to an AWS IoT SiteWise resource.
If a tag already exists for the resource, this operation updates the tag's
value.
"""
def tag_resource(%Client{} = client, input, options \\ []) do
url_path = "/tags"
headers = []
{query_params, input} =
[
{"resourceArn", "resourceArn"}
]
|> Request.build_params(input)
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Removes a tag from an AWS IoT SiteWise resource.
"""
def untag_resource(%Client{} = client, input, options \\ []) do
url_path = "/tags"
headers = []
{query_params, input} =
[
{"resourceArn", "resourceArn"},
{"tagKeys", "tagKeys"}
]
|> Request.build_params(input)
Request.request_rest(
client,
metadata(),
:delete,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Updates an existing access policy that specifies an identity's access to an AWS
IoT SiteWise Monitor portal or project resource.
"""
def update_access_policy(%Client{} = client, access_policy_id, input, options \\ []) do
url_path = "/access-policies/#{URI.encode(access_policy_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
200
)
end
@doc """
Updates an asset's name.
For more information, see [Updating assets and models](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/update-assets-and-models.html)
in the *AWS IoT SiteWise User Guide*.
"""
def update_asset(%Client{} = client, asset_id, input, options \\ []) do
url_path = "/assets/#{URI.encode(asset_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Updates an asset model and all of the assets that were created from the model.
Each asset created from the model inherits the updated asset model's property
and hierarchy definitions. For more information, see [Updating assets and models](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/update-assets-and-models.html)
in the *AWS IoT SiteWise User Guide*.
This operation overwrites the existing model with the provided model. To avoid
deleting your asset model's properties or hierarchies, you must include their
IDs and definitions in the updated asset model payload. For more information,
see
[DescribeAssetModel](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeAssetModel.html).
If you remove a property from an asset model, AWS IoT SiteWise deletes all
previous data for that property. If you remove a hierarchy definition from an
asset model, AWS IoT SiteWise disassociates every asset associated with that
hierarchy. You can't change the type or data type of an existing property.
"""
def update_asset_model(%Client{} = client, asset_model_id, input, options \\ []) do
url_path = "/asset-models/#{URI.encode(asset_model_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Updates an asset property's alias and notification state.
This operation overwrites the property's existing alias and notification state.
To keep your existing property's alias or notification state, you must include
the existing values in the UpdateAssetProperty request. For more information,
see
[DescribeAssetProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeAssetProperty.html).
"""
def update_asset_property(%Client{} = client, asset_id, property_id, input, options \\ []) do
url_path = "/assets/#{URI.encode(asset_id)}/properties/#{URI.encode(property_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Updates an AWS IoT SiteWise Monitor dashboard.
"""
def update_dashboard(%Client{} = client, dashboard_id, input, options \\ []) do
url_path = "/dashboards/#{URI.encode(dashboard_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
200
)
end
@doc """
Updates a gateway's name.
"""
def update_gateway(%Client{} = client, gateway_id, input, options \\ []) do
url_path = "/20200301/gateways/#{URI.encode(gateway_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
nil
)
end
@doc """
Updates a gateway capability configuration or defines a new capability
configuration.
Each gateway capability defines data sources for a gateway. A capability
configuration can contain multiple data source configurations. If you define
OPC-UA sources for a gateway in the AWS IoT SiteWise console, all of your OPC-UA
sources are stored in one capability configuration. To list all capability
configurations for a gateway, use
[DescribeGateway](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGateway.html).
"""
def update_gateway_capability_configuration(
%Client{} = client,
gateway_id,
input,
options \\ []
) do
url_path = "/20200301/gateways/#{URI.encode(gateway_id)}/capability"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:post,
url_path,
query_params,
headers,
input,
options,
201
)
end
@doc """
Updates an AWS IoT SiteWise Monitor portal.
"""
def update_portal(%Client{} = client, portal_id, input, options \\ []) do
url_path = "/portals/#{URI.encode(portal_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
202
)
end
@doc """
Updates an AWS IoT SiteWise Monitor project.
"""
def update_project(%Client{} = client, project_id, input, options \\ []) do
url_path = "/projects/#{URI.encode(project_id)}"
headers = []
query_params = []
Request.request_rest(
client,
metadata(),
:put,
url_path,
query_params,
headers,
input,
options,
200
)
end
end | 23.535787 | 260 | 0.613976 |
9e8528a3e0604f5545d15f6dc09286abd7627b90 | 2,750 | exs | Elixir | mix.exs | romenigld/blog | ce808e024dbea16a829916f090a2545938f24236 | [
"MIT"
] | null | null | null | mix.exs | romenigld/blog | ce808e024dbea16a829916f090a2545938f24236 | [
"MIT"
] | 4 | 2021-06-23T16:48:58.000Z | 2021-07-08T17:25:11.000Z | mix.exs | romenigld/blog | ce808e024dbea16a829916f090a2545938f24236 | [
"MIT"
] | null | null | null | defmodule Blog.MixProject do
use Mix.Project
@github_url "https://github.com/romenigld/blog"
def project do
[
app: :blog,
version: "0.1.0",
elixir: "~> 1.11",
description: "Projeto para aprender fundamentos do Phoenix com Elixir",
source_url: @github_url,
homepage_url: @github_url,
files: ~w[mix.exs lib LICENSE.md README.md CHANGELOG.md],
package: [
maintainers: ["Romenig Lima Damasio"],
licenses: ["MIT"],
links: %{
"Github" => @github_url
}
],
docs: [
main: "readme",
extras: ["README.md", "CHANGELOG.md"]
],
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.json": :test
]
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {Blog.Application, []},
extra_applications: [:logger, :runtime_tools, :ueberauth_google]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.5.7"},
{:phoenix_ecto, "~> 4.1"},
{:ecto_sql, "~> 3.4"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.11"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_dashboard, "~> 0.4"},
{:telemetry_metrics, "~> 0.4"},
{:telemetry_poller, "~> 0.4"},
{:gettext, "~> 0.11"},
{:jason, "~> 1.0"},
{:plug_cowboy, "~> 2.0"},
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
{:sobelow, "~> 0.8", only: :dev},
{:excoveralls, "~> 0.10", only: :test},
{:ueberauth_google, "~> 0.10"}
]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, to install project dependencies and perform other setup tasks, run:
#
# $ mix setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
setup: ["deps.get", "ecto.setup", "cmd npm install --prefix assets"],
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.reset --quiet", "test"]
]
end
end
| 28.947368 | 84 | 0.565091 |
9e852ddc77507a0a59de13242b47a28670a9f007 | 115 | exs | Elixir | .formatter.exs | JulianaHelena5/score | 153122d88586d00c11c73ac447fd14cf95599805 | [
"MIT"
] | 3 | 2021-08-09T14:17:42.000Z | 2022-03-01T17:31:03.000Z | .formatter.exs | JulianaHelena5/score | 153122d88586d00c11c73ac447fd14cf95599805 | [
"MIT"
] | 3 | 2021-08-09T12:27:01.000Z | 2021-08-10T08:54:22.000Z | .formatter.exs | JulianaHelena5/score | 153122d88586d00c11c73ac447fd14cf95599805 | [
"MIT"
] | null | null | null | [
import_deps: [:phoenix],
inputs: ["*.{ex,exs}", "{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
| 23 | 83 | 0.53913 |
9e8572d9973f193b95fcc52443928095711346bc | 5,272 | exs | Elixir | test/json_schema_test_suite/draft6/one_of_test.exs | hrzndhrn/json_xema | 955eab7b0919d144b38364164d90275201c89474 | [
"MIT"
] | 54 | 2019-03-10T19:51:07.000Z | 2021-12-23T07:31:09.000Z | test/json_schema_test_suite/draft6/one_of_test.exs | hrzndhrn/json_xema | 955eab7b0919d144b38364164d90275201c89474 | [
"MIT"
] | 36 | 2018-05-20T09:13:20.000Z | 2021-03-14T15:22:03.000Z | test/json_schema_test_suite/draft6/one_of_test.exs | hrzndhrn/json_xema | 955eab7b0919d144b38364164d90275201c89474 | [
"MIT"
] | 3 | 2019-04-12T09:08:51.000Z | 2019-12-04T01:23:56.000Z | defmodule JsonSchemaTestSuite.Draft6.OneOfTest do
use ExUnit.Case
import JsonXema, only: [valid?: 2]
describe ~s|oneOf| do
setup do
%{schema: JsonXema.new(%{"oneOf" => [%{"type" => "integer"}, %{"minimum" => 2}]})}
end
test ~s|first oneOf valid|, %{schema: schema} do
assert valid?(schema, 1)
end
test ~s|second oneOf valid|, %{schema: schema} do
assert valid?(schema, 2.5)
end
test ~s|both oneOf valid|, %{schema: schema} do
refute valid?(schema, 3)
end
test ~s|neither oneOf valid|, %{schema: schema} do
refute valid?(schema, 1.5)
end
end
describe ~s|oneOf with base schema| do
setup do
%{
schema:
JsonXema.new(%{
"oneOf" => [%{"minLength" => 2}, %{"maxLength" => 4}],
"type" => "string"
})
}
end
test ~s|mismatch base schema|, %{schema: schema} do
refute valid?(schema, 3)
end
test ~s|one oneOf valid|, %{schema: schema} do
assert valid?(schema, "foobar")
end
test ~s|both oneOf valid|, %{schema: schema} do
refute valid?(schema, "foo")
end
end
describe ~s|oneOf with boolean schemas, all true| do
setup do
%{schema: JsonXema.new(%{"oneOf" => [true, true, true]})}
end
test ~s|any value is invalid|, %{schema: schema} do
refute valid?(schema, "foo")
end
end
describe ~s|oneOf with boolean schemas, one true| do
setup do
%{schema: JsonXema.new(%{"oneOf" => [true, false, false]})}
end
test ~s|any value is valid|, %{schema: schema} do
assert valid?(schema, "foo")
end
end
describe ~s|oneOf with boolean schemas, more than one true| do
setup do
%{schema: JsonXema.new(%{"oneOf" => [true, true, false]})}
end
test ~s|any value is invalid|, %{schema: schema} do
refute valid?(schema, "foo")
end
end
describe ~s|oneOf with boolean schemas, all false| do
setup do
%{schema: JsonXema.new(%{"oneOf" => [false, false, false]})}
end
test ~s|any value is invalid|, %{schema: schema} do
refute valid?(schema, "foo")
end
end
describe ~s|oneOf complex types| do
setup do
%{
schema:
JsonXema.new(%{
"oneOf" => [
%{"properties" => %{"bar" => %{"type" => "integer"}}, "required" => ["bar"]},
%{"properties" => %{"foo" => %{"type" => "string"}}, "required" => ["foo"]}
]
})
}
end
test ~s|first oneOf valid (complex)|, %{schema: schema} do
assert valid?(schema, %{"bar" => 2})
end
test ~s|second oneOf valid (complex)|, %{schema: schema} do
assert valid?(schema, %{"foo" => "baz"})
end
test ~s|both oneOf valid (complex)|, %{schema: schema} do
refute valid?(schema, %{"bar" => 2, "foo" => "baz"})
end
test ~s|neither oneOf valid (complex)|, %{schema: schema} do
refute valid?(schema, %{"bar" => "quux", "foo" => 2})
end
end
describe ~s|oneOf with empty schema| do
setup do
%{schema: JsonXema.new(%{"oneOf" => [%{"type" => "number"}, %{}]})}
end
test ~s|one valid - valid|, %{schema: schema} do
assert valid?(schema, "foo")
end
test ~s|both valid - invalid|, %{schema: schema} do
refute valid?(schema, 123)
end
end
describe ~s|oneOf with required| do
setup do
%{
schema:
JsonXema.new(%{
"oneOf" => [%{"required" => ["foo", "bar"]}, %{"required" => ["foo", "baz"]}],
"type" => "object"
})
}
end
test ~s|both invalid - invalid|, %{schema: schema} do
refute valid?(schema, %{"bar" => 2})
end
test ~s|first valid - valid|, %{schema: schema} do
assert valid?(schema, %{"bar" => 2, "foo" => 1})
end
test ~s|second valid - valid|, %{schema: schema} do
assert valid?(schema, %{"baz" => 3, "foo" => 1})
end
test ~s|both valid - invalid|, %{schema: schema} do
refute valid?(schema, %{"bar" => 2, "baz" => 3, "foo" => 1})
end
end
describe ~s|oneOf with missing optional property| do
setup do
%{
schema:
JsonXema.new(%{
"oneOf" => [
%{"properties" => %{"bar" => true, "baz" => true}, "required" => ["bar"]},
%{"properties" => %{"foo" => true}, "required" => ["foo"]}
]
})
}
end
test ~s|first oneOf valid|, %{schema: schema} do
assert valid?(schema, %{"bar" => 8})
end
test ~s|second oneOf valid|, %{schema: schema} do
assert valid?(schema, %{"foo" => "foo"})
end
test ~s|both oneOf valid|, %{schema: schema} do
refute valid?(schema, %{"bar" => 8, "foo" => "foo"})
end
test ~s|neither oneOf valid|, %{schema: schema} do
refute valid?(schema, %{"baz" => "quux"})
end
end
describe ~s|nested oneOf, to check validation semantics| do
setup do
%{schema: JsonXema.new(%{"oneOf" => [%{"oneOf" => [%{"type" => "null"}]}]})}
end
test ~s|null is valid|, %{schema: schema} do
assert valid?(schema, nil)
end
test ~s|anything non-null is invalid|, %{schema: schema} do
refute valid?(schema, 123)
end
end
end
| 25.346154 | 91 | 0.531108 |
9e8575b6cc356e4a120403725dac9841ed992ec4 | 368 | ex | Elixir | lib/hl7/2.3/segments/msa.ex | calvinb/elixir-hl7 | 5e953fa11f9184857c0ec4dda8662889f35a6bec | [
"Apache-2.0"
] | null | null | null | lib/hl7/2.3/segments/msa.ex | calvinb/elixir-hl7 | 5e953fa11f9184857c0ec4dda8662889f35a6bec | [
"Apache-2.0"
] | null | null | null | lib/hl7/2.3/segments/msa.ex | calvinb/elixir-hl7 | 5e953fa11f9184857c0ec4dda8662889f35a6bec | [
"Apache-2.0"
] | null | null | null | defmodule HL7.V2_3.Segments.MSA do
@moduledoc false
require Logger
alias HL7.V2_3.{DataTypes}
use HL7.Segment,
fields: [
segment: nil,
acknowledgement_code: nil,
message_control_id: nil,
text_message: nil,
expected_sequence_number: nil,
delayed_acknowledgement_type: nil,
error_condition: DataTypes.Ce
]
end
| 20.444444 | 40 | 0.684783 |
9e85a3976addfb5209b32d6433c7b4b401aab2c7 | 500 | exs | Elixir | config/integration.exs | SmartColumbusOS/smart_city_registry | 6e656cfd7d34443fac44f87207218dc2670e60c0 | [
"Apache-2.0"
] | 1 | 2019-07-09T15:48:32.000Z | 2019-07-09T15:48:32.000Z | config/integration.exs | SmartColumbusOS/smart_city_registry | 6e656cfd7d34443fac44f87207218dc2670e60c0 | [
"Apache-2.0"
] | 6 | 2019-05-21T04:16:45.000Z | 2019-12-12T21:36:01.000Z | config/integration.exs | SmartColumbusOS/smart_city_registry | 6e656cfd7d34443fac44f87207218dc2670e60c0 | [
"Apache-2.0"
] | null | null | null | use Mix.Config
host =
case System.get_env("HOST_IP") do
nil -> "127.0.0.1"
defined -> defined
end
config :smart_city_registry,
redis: [
host: host
]
config :smart_city_registry,
divo: %{
version: "3.4",
services: %{
redis: %{
image: "redis:5.0.3",
ports: ["6379:6379"],
healthcheck: %{test: ["CMD-SHELL", "/usr/local/bin/redis-cli ping | grep PONG || exit 1"], interval: "1s"}
}
}
},
divo_wait: [dwell: 500, max_tries: 50]
| 19.230769 | 114 | 0.56 |
9e85b528aaeb073813b84a39f2a6a09d1158e3f5 | 2,131 | ex | Elixir | clients/ad_sense_host/lib/google_api/ad_sense_host/v41/model/ad_unit_content_ads_settings.ex | matehat/elixir-google-api | c1b2523c2c4cdc9e6ca4653ac078c94796b393c3 | [
"Apache-2.0"
] | 1 | 2018-12-03T23:43:10.000Z | 2018-12-03T23:43:10.000Z | clients/ad_sense_host/lib/google_api/ad_sense_host/v41/model/ad_unit_content_ads_settings.ex | matehat/elixir-google-api | c1b2523c2c4cdc9e6ca4653ac078c94796b393c3 | [
"Apache-2.0"
] | null | null | null | clients/ad_sense_host/lib/google_api/ad_sense_host/v41/model/ad_unit_content_ads_settings.ex | matehat/elixir-google-api | c1b2523c2c4cdc9e6ca4653ac078c94796b393c3 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This class is auto generated by the elixir code generator program.
# Do not edit the class manually.
defmodule GoogleApi.AdSenseHost.V41.Model.AdUnitContentAdsSettings do
@moduledoc """
Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated).
## Attributes
* `backupOption` (*type:* `GoogleApi.AdSenseHost.V41.Model.AdUnitContentAdsSettingsBackupOption.t`, *default:* `nil`) - The backup option to be used in instances where no ad is available.
* `size` (*type:* `String.t`, *default:* `nil`) - Size of this ad unit. Size values are in the form SIZE_{width}_{height}.
* `type` (*type:* `String.t`, *default:* `nil`) - Type of this ad unit. Possible values are TEXT, TEXT_IMAGE, IMAGE and LINK.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:backupOption =>
GoogleApi.AdSenseHost.V41.Model.AdUnitContentAdsSettingsBackupOption.t(),
:size => String.t(),
:type => String.t()
}
field(:backupOption, as: GoogleApi.AdSenseHost.V41.Model.AdUnitContentAdsSettingsBackupOption)
field(:size)
field(:type)
end
defimpl Poison.Decoder, for: GoogleApi.AdSenseHost.V41.Model.AdUnitContentAdsSettings do
def decode(value, options) do
GoogleApi.AdSenseHost.V41.Model.AdUnitContentAdsSettings.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.AdSenseHost.V41.Model.AdUnitContentAdsSettings do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 39.462963 | 191 | 0.733458 |
9e85b88152a389a8c92342444d6a9d7c789cc9bc | 6,665 | exs | Elixir | test/asteroid_web/controllers/api/oauth2/device_authorization_controller_test.exs | tanguilp/asteroid | 8e03221d365da7f03f82df192c535d3ba2101f4d | [
"Apache-2.0"
] | 36 | 2019-07-23T20:01:05.000Z | 2021-08-05T00:52:34.000Z | test/asteroid_web/controllers/api/oauth2/device_authorization_controller_test.exs | tanguilp/asteroid | 8e03221d365da7f03f82df192c535d3ba2101f4d | [
"Apache-2.0"
] | 19 | 2019-08-23T19:04:50.000Z | 2021-05-07T22:12:25.000Z | test/asteroid_web/controllers/api/oauth2/device_authorization_controller_test.exs | tanguilp/asteroid | 8e03221d365da7f03f82df192c535d3ba2101f4d | [
"Apache-2.0"
] | 3 | 2019-09-06T10:47:20.000Z | 2020-09-09T03:43:31.000Z | defmodule AsteroidWeb.API.OAuth2.DeviceAuthorizationControllerTest do
use AsteroidWeb.ConnCase, async: true
import Asteroid.Utils
alias OAuth2Utils.Scope
alias AsteroidWeb.Router.Helpers, as: Routes
alias Asteroid.Token.DeviceCode
# error cases
test "no credentials for confidential client", %{conn: conn} do
req = %{}
conn =
conn
|> post(Routes.device_authorization_path(conn, :handle), req)
assert Plug.Conn.get_resp_header(conn, "www-authenticate") |> List.first() =~
~s(Basic realm="Asteroid")
response = json_response(conn, 401)
assert response["error"] == "invalid_client"
end
test "invalid basic credentials for confidential client", %{conn: conn} do
req_body = %{}
conn =
conn
|> put_req_header("authorization", basic_auth_header("client_confidential_1", "invalid"))
|> post(Routes.device_authorization_path(conn, :handle), req_body)
assert Plug.Conn.get_resp_header(conn, "www-authenticate") |> List.first() =~
~s(Basic realm="Asteroid")
response = json_response(conn, 401)
assert response["error"] == "invalid_client"
end
test "unknown public client", %{conn: conn} do
req = %{"client_id" => "unkown_public_client"}
conn =
conn
|> post(Routes.device_authorization_path(conn, :handle), req)
assert Plug.Conn.get_resp_header(conn, "www-authenticate") |> List.first() =~
~s(Basic realm="Asteroid")
response = json_response(conn, 401)
assert response["error"] == "invalid_client"
end
test "malformed public client", %{conn: conn} do
req = %{"client_id" => "unkown⌿public_client"}
response =
conn
|> post(Routes.device_authorization_path(conn, :handle), req)
|> json_response(400)
assert response["error"] == "invalid_request"
end
test "malformed scope parameter", %{conn: conn} do
req = %{
"client_id" => "client_public_1",
"scope" => "scp1 scp2 scpů"
}
response =
conn
|> post(Routes.device_authorization_path(conn, :handle), req)
|> json_response(400)
assert response["error"] == "invalid_scope"
end
test "unauthorized grant type", %{conn: conn} do
req = %{"client_id" => "client_confidential_2"}
response =
conn
|> put_req_header("authorization", basic_auth_header("client_confidential_2", "password2"))
|> post(Routes.device_authorization_path(conn, :handle), req)
|> json_response(400)
assert response["error"] == "unauthorized_client"
end
test "unauthorized scope", %{conn: conn} do
req = %{
"client_id" => "client_public_1",
"scope" => "scp1 scp2 scp9"
}
response =
conn
|> post(Routes.device_authorization_path(conn, :handle), req)
|> json_response(400)
assert response["error"] == "invalid_scope"
end
# success cases
test "successful request confidential client without scopes", %{conn: conn} do
req = %{}
response =
conn
|> put_req_header("authorization", basic_auth_header("client_confidential_1", "password1"))
|> post(Routes.device_authorization_path(conn, :handle), req)
|> json_response(200)
assert is_binary(response["device_code"])
assert is_binary(response["user_code"])
assert is_binary(response["verification_uri"])
assert is_binary(response["verification_uri_complete"])
assert is_integer(response["expires_in"])
assert response["interval"] ==
astrenv(:oauth2_flow_device_authorization_rate_limiter_interval)
{:ok, device_code} = DeviceCode.get(response["device_code"])
assert device_code.user_code == response["user_code"]
assert device_code.data["clid"] == "client_confidential_1"
assert device_code.data["sjid"] == nil
assert device_code.data["requested_scopes"] == []
assert device_code.data["granted_scopes"] == nil
assert device_code.data["status"] == "authorization_pending"
end
test "successful request confidential client with scopes", %{conn: conn} do
req = %{"scope" => "scp1 scp2 scp5 scp6"}
response =
conn
|> put_req_header("authorization", basic_auth_header("client_confidential_1", "password1"))
|> post(Routes.device_authorization_path(conn, :handle), req)
|> json_response(200)
assert is_binary(response["device_code"])
assert is_binary(response["user_code"])
assert is_binary(response["verification_uri"])
assert is_binary(response["verification_uri_complete"])
assert is_integer(response["expires_in"])
assert response["interval"] ==
astrenv(:oauth2_flow_device_authorization_rate_limiter_interval)
# there is not such an attribute returned
assert response["scope"] == nil
{:ok, device_code} = DeviceCode.get(response["device_code"])
assert device_code.user_code == response["user_code"]
assert device_code.data["clid"] == "client_confidential_1"
assert device_code.data["sjid"] == nil
assert device_code.data["granted_scopes"] == nil
assert Scope.Set.equal?(
Scope.Set.new(device_code.data["requested_scopes"]),
Scope.Set.new(["scp1", "scp2", "scp6", "scp5"])
)
assert device_code.data["status"] == "authorization_pending"
end
test "successful request public client with scopes", %{conn: conn} do
req = %{
"scope" => "scp1 scp3 scp5",
"client_id" => "client_public_1"
}
response =
conn
|> post(Routes.device_authorization_path(conn, :handle), req)
|> json_response(200)
assert is_binary(response["device_code"])
assert is_binary(response["user_code"])
assert is_binary(response["verification_uri"])
assert is_binary(response["verification_uri_complete"])
assert is_integer(response["expires_in"])
assert response["interval"] ==
astrenv(:oauth2_flow_device_authorization_rate_limiter_interval)
# there is not such an attribute returned
assert response["scope"] == nil
{:ok, device_code} = DeviceCode.get(response["device_code"])
assert device_code.user_code == response["user_code"]
assert device_code.data["clid"] == "client_public_1"
assert device_code.data["sjid"] == nil
assert device_code.data["granted_scopes"] == nil
assert Scope.Set.equal?(
Scope.Set.new(device_code.data["requested_scopes"]),
Scope.Set.new(["scp1", "scp3", "scp5"])
)
assert device_code.data["status"] == "authorization_pending"
end
defp basic_auth_header(client, secret) do
"Basic " <> Base.encode64(client <> ":" <> secret)
end
end
| 30.714286 | 97 | 0.667967 |
9e85ba35f3633f0b8cfc0aa6ab4db219fbeb59e1 | 263 | ex | Elixir | test/unit/fixtures/template/renderers/element_node_renderer/module_2.ex | gregjohnsonsaltaire/hologram | aa8e9ea0d599def864c263cc37cc8ee31f02ac4a | [
"MIT"
] | 40 | 2022-01-19T20:27:36.000Z | 2022-03-31T18:17:41.000Z | test/unit/fixtures/template/renderers/element_node_renderer/module_2.ex | gregjohnsonsaltaire/hologram | aa8e9ea0d599def864c263cc37cc8ee31f02ac4a | [
"MIT"
] | 42 | 2022-02-03T22:52:43.000Z | 2022-03-26T20:57:32.000Z | test/unit/fixtures/template/renderers/element_node_renderer/module_2.ex | gregjohnsonsaltaire/hologram | aa8e9ea0d599def864c263cc37cc8ee31f02ac4a | [
"MIT"
] | 3 | 2022-02-10T04:00:37.000Z | 2022-03-08T22:07:45.000Z | defmodule Hologram.Test.Fixtures.Template.ElementNodeRenderer.Module2 do
use Hologram.Component
def init(_props) do
%{
component_2_state_key: "component_2_state_value"
}
end
def template do
~H"""
(in component 2)
"""
end
end
| 16.4375 | 72 | 0.680608 |
9e8601557ca3d28d804e8ee4b900c75f906330a8 | 483 | exs | Elixir | test/validation/rules/odd_test.exs | adolfont/validation | 6288f5a5745f645c90b6f6241e14f0088c218f5b | [
"MIT"
] | 60 | 2019-09-13T13:37:01.000Z | 2021-01-06T05:20:32.000Z | test/validation/rules/odd_test.exs | adolfont/validation | 6288f5a5745f645c90b6f6241e14f0088c218f5b | [
"MIT"
] | 1 | 2019-12-16T13:57:22.000Z | 2019-12-16T13:57:22.000Z | test/validation/rules/odd_test.exs | adolfont/validation | 6288f5a5745f645c90b6f6241e14f0088c218f5b | [
"MIT"
] | 5 | 2019-09-13T19:14:24.000Z | 2019-11-26T17:33:08.000Z | defmodule Validation.Rules.OddTest do
use ExUnit.Case
alias Validation.Rules.Odd, as: V
doctest Validation
test "valid odd" do
assert V.validate?(1)
assert V.validate?(3)
assert V.validate?(5)
assert V.validate?(-1)
assert V.validate?(9_999_999)
end
test "invalid odd" do
refute V.validate?(0)
refute V.validate?(2)
refute V.validate?(4)
refute V.validate?(100)
refute V.validate?(-2)
refute V.validate?(9_999_998)
end
end
| 21 | 37 | 0.666667 |
9e860f41b420d2332960e6ad6ff99395a657c041 | 447 | exs | Elixir | priv/repo/migrations/20210226191952_add_more_fields_to_widget_settings.exs | ZmagoD/papercups | dff9a5822b809edc4fd8ecf198566f9b14ab613f | [
"MIT"
] | 4,942 | 2020-07-20T22:35:28.000Z | 2022-03-31T15:38:51.000Z | priv/repo/migrations/20210226191952_add_more_fields_to_widget_settings.exs | ZmagoD/papercups | dff9a5822b809edc4fd8ecf198566f9b14ab613f | [
"MIT"
] | 552 | 2020-07-22T01:39:04.000Z | 2022-02-01T00:26:35.000Z | priv/repo/migrations/20210226191952_add_more_fields_to_widget_settings.exs | ZmagoD/papercups | dff9a5822b809edc4fd8ecf198566f9b14ab613f | [
"MIT"
] | 396 | 2020-07-22T19:27:48.000Z | 2022-03-31T05:25:24.000Z | defmodule ChatApi.Repo.Migrations.AddMoreFieldsToWidgetSettings do
use Ecto.Migration
def change do
alter table(:widget_settings) do
add(:is_open_by_default, :boolean, default: false)
add(:icon_variant, :string, default: "outlined")
add(:custom_icon_url, :string)
add(:iframe_url_override, :string)
add(:email_input_placeholder, :string)
add(:new_messages_notification_text, :string)
end
end
end
| 29.8 | 66 | 0.722595 |
9e8647762b2f4e4066377a56bdb526ed78460ee6 | 1,582 | ex | Elixir | clients/double_click_bid_manager/lib/google_api/double_click_bid_manager/v1/model/download_line_items_response.ex | matehat/elixir-google-api | c1b2523c2c4cdc9e6ca4653ac078c94796b393c3 | [
"Apache-2.0"
] | 1 | 2018-12-03T23:43:10.000Z | 2018-12-03T23:43:10.000Z | clients/double_click_bid_manager/lib/google_api/double_click_bid_manager/v1/model/download_line_items_response.ex | matehat/elixir-google-api | c1b2523c2c4cdc9e6ca4653ac078c94796b393c3 | [
"Apache-2.0"
] | null | null | null | clients/double_click_bid_manager/lib/google_api/double_click_bid_manager/v1/model/download_line_items_response.ex | matehat/elixir-google-api | c1b2523c2c4cdc9e6ca4653ac078c94796b393c3 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This class is auto generated by the elixir code generator program.
# Do not edit the class manually.
defmodule GoogleApi.DoubleClickBidManager.V1.Model.DownloadLineItemsResponse do
@moduledoc """
Download line items response.
## Attributes
* `lineItems` (*type:* `String.t`, *default:* `nil`) - Retrieved line items in CSV format. For more information about file formats, see Entity Write File Format.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:lineItems => String.t()
}
field(:lineItems)
end
defimpl Poison.Decoder, for: GoogleApi.DoubleClickBidManager.V1.Model.DownloadLineItemsResponse do
def decode(value, options) do
GoogleApi.DoubleClickBidManager.V1.Model.DownloadLineItemsResponse.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.DoubleClickBidManager.V1.Model.DownloadLineItemsResponse do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 33.659574 | 166 | 0.755373 |
9e864ee827cb3ee77dee1e1d1c9f9bd09913a1ef | 80 | ex | Elixir | lib/component/definitions/enemy.ex | doawoo/elixir_rpg | 4dcd0eb717bd1d654b3e6a06be31aba4c3254fb3 | [
"MIT"
] | 23 | 2021-10-24T00:21:13.000Z | 2022-03-13T12:33:38.000Z | lib/component/definitions/enemy.ex | doawoo/elixir_rpg | 4dcd0eb717bd1d654b3e6a06be31aba4c3254fb3 | [
"MIT"
] | null | null | null | lib/component/definitions/enemy.ex | doawoo/elixir_rpg | 4dcd0eb717bd1d654b3e6a06be31aba4c3254fb3 | [
"MIT"
] | 3 | 2021-11-04T02:42:25.000Z | 2022-02-02T14:22:52.000Z | use ElixirRPG.DSL.Component
defcomponent Enemy do
member :is_enemy, true
end
| 13.333333 | 27 | 0.8 |
9e865a53098238f637a5f76bd9837d1d5e4a1f42 | 1,291 | exs | Elixir | mix.exs | Schultzer/clicky | 4018f4b37dc08e4323cc53d3251cdeb744f49ccc | [
"Unlicense",
"MIT"
] | null | null | null | mix.exs | Schultzer/clicky | 4018f4b37dc08e4323cc53d3251cdeb744f49ccc | [
"Unlicense",
"MIT"
] | null | null | null | mix.exs | Schultzer/clicky | 4018f4b37dc08e4323cc53d3251cdeb744f49ccc | [
"Unlicense",
"MIT"
] | null | null | null | defmodule Clicky.Mixfile do
use Mix.Project
@version "0.1.0"
def project do
[
app: :clicky,
version: @version,
elixir: "~> 1.5",
name: "Clicky",
source_url: "https://github.com/schultzer/clicky",
description: description(),
package: package(),
docs: docs(),
start_permanent: Mix.env == :prod,
deps: deps()
]
end
defp description do
"""
A wrapper around https://clicky.com/help/api
"""
end
def application do
[
extra_applications: [:logger]
]
end
defp deps do
[
{:httpoison, "> 0.11.0"},
{:jason, "~> 1.0.0-rc.2"}
]
end
defp package do
[
maintainers: ["Benjamin Schultzer"],
licenses: ["MIT"],
links: links(),
files: [
"lib", "config", "mix.exs", "README*", "CHANGELOG*", "LICENSE*"
]
]
end
def docs do
[
source_ref: "v#{@version}",
main: "readme",
extras: ["README.md", "CHANGELOG.md"]
]
end
def links do
%{
"GitHub" => "https://github.com/schultzer/clicky",
"Readme" => "https://github.com/schultzer/clicky/blob/v#{@version}/README.md",
"Changelog" => "https://github.com/schultzer/clicky/blob/v#{@version}/CHANGELOG.md"
}
end
end
| 18.985294 | 89 | 0.536793 |
9e866b8128ed0111e8c7b35a56e68afa45e76997 | 3,369 | ex | Elixir | apps/core/lib/core/legal_entities/legal_entity.ex | ehealth-ua/ehealth.api | 4ffe26a464fe40c95fb841a4aa2e147068f65ca2 | [
"Apache-2.0"
] | 8 | 2019-06-14T11:34:49.000Z | 2021-08-05T19:14:24.000Z | apps/core/lib/core/legal_entities/legal_entity.ex | edenlabllc/ehealth.api.public | 4ffe26a464fe40c95fb841a4aa2e147068f65ca2 | [
"Apache-2.0"
] | 1 | 2019-07-08T15:20:22.000Z | 2019-07-08T15:20:22.000Z | apps/core/lib/core/legal_entities/legal_entity.ex | ehealth-ua/ehealth.api | 4ffe26a464fe40c95fb841a4aa2e147068f65ca2 | [
"Apache-2.0"
] | 6 | 2018-05-11T13:59:32.000Z | 2022-01-19T20:15:22.000Z | defmodule Core.LegalEntities.LegalEntity do
@moduledoc false
use Ecto.Schema
alias Core.Divisions.Division
alias Core.Employees.Employee
alias Core.LegalEntities.EdrData
alias Core.LegalEntities.License
alias Core.LegalEntities.MedicalServiceProvider
alias Core.LegalEntities.RelatedLegalEntity
alias Core.LegalEntities.SignedContent
alias Ecto.UUID
@derive {Jason.Encoder, except: [:__meta__]}
@status_active "ACTIVE"
@status_suspended "SUSPENDED"
@status_closed "CLOSED"
@status_reorganized "REORGANIZED"
@type_mis "MIS"
@type_msp "MSP"
@type_msp_pharmacy "MSP_PHARMACY"
@type_nhs "NHS"
@type_outpatient "OUTPATIENT"
@type_pharmacy "PHARMACY"
@type_primary_care "PRIMARY_CARE"
@mis_verified_verified "VERIFIED"
@mis_verified_not_verified "NOT_VERIFIED"
def type(:mis), do: @type_mis
def type(:msp), do: @type_msp
def type(:msp_pharmacy), do: @type_msp_pharmacy
def type(:nhs), do: @type_nhs
def type(:outpatient), do: @type_outpatient
def type(:pharmacy), do: @type_pharmacy
def type(:primary_care), do: @type_primary_care
def mis_verified(:verified), do: @mis_verified_verified
def mis_verified(:not_verified), do: @mis_verified_not_verified
def status(:active), do: @status_active
def status(:suspended), do: @status_suspended
def status(:closed), do: @status_closed
def status(:reorganized), do: @status_reorganized
@primary_key {:id, :binary_id, autogenerate: true}
schema "legal_entities" do
field(:is_active, :boolean, default: false)
field(:nhs_verified, :boolean, default: false)
field(:nhs_unverified_at, :utc_datetime_usec)
field(:nhs_reviewed, :boolean, default: false)
field(:nhs_comment, :string, default: "")
field(:addresses, {:array, :map})
field(:edrpou, :string)
field(:email, :string)
field(:kveds, {:array, :string})
field(:legal_form, :string)
field(:name, :string)
field(:owner_property_type, :string)
field(:phones, {:array, :map})
field(:archive, {:array, :map})
field(:receiver_funds_code, :string)
field(:website, :string)
field(:beneficiary, :string)
field(:public_name, :string)
field(:short_name, :string)
field(:status, :string)
field(:mis_verified, :string)
field(:type, :string)
field(:inserted_by, Ecto.UUID)
field(:updated_by, Ecto.UUID)
field(:capitation_contract_id, :id)
field(:created_by_mis_client_id, Ecto.UUID)
field(:edr_verified, :boolean)
field(:registration_address, :map)
field(:residence_address, :map)
field(:accreditation, :map)
field(:status_reason, :string)
field(:reason, :string)
has_one(:medical_service_provider, MedicalServiceProvider, on_replace: :delete, foreign_key: :legal_entity_id)
has_one(:merged_to_legal_entity, RelatedLegalEntity, foreign_key: :merged_from_id)
has_one(:employee, Employee, foreign_key: :legal_entity_id)
has_many(:employees, Employee, foreign_key: :legal_entity_id)
has_many(:divisions, Division, foreign_key: :legal_entity_id)
has_many(:merged_from_legal_entities, RelatedLegalEntity, foreign_key: :merged_to_id)
has_many(:signed_content_history, SignedContent, foreign_key: :legal_entity_id)
belongs_to(:edr_data, EdrData, type: UUID)
belongs_to(:license, License, type: UUID)
timestamps(type: :utc_datetime_usec)
end
end
| 34.731959 | 114 | 0.732858 |
9e8671312a461ed9d84615d54c95f312af0a9452 | 1,635 | exs | Elixir | test/boggle_engine/neighbor/transform/standard_map_test.exs | rtvu/boggle_engine | ae40c2c95dc3e1c1bcd684a19cba11e583828b9d | [
"MIT"
] | null | null | null | test/boggle_engine/neighbor/transform/standard_map_test.exs | rtvu/boggle_engine | ae40c2c95dc3e1c1bcd684a19cba11e583828b9d | [
"MIT"
] | null | null | null | test/boggle_engine/neighbor/transform/standard_map_test.exs | rtvu/boggle_engine | ae40c2c95dc3e1c1bcd684a19cba11e583828b9d | [
"MIT"
] | null | null | null | defmodule BoggleEngine.Neighbor.Transform.StandardMapTest do
use ExUnit.Case
alias BoggleEngine.Neighbor.Transform.StandardMap
test "errors are passed through" do
assert {:error, _, _} = StandardMap.transform({:error, nil, nil})
end
test "boggle inner corners are valid" do
assert {:ok, 0, {5, -1, -1, 4}} = StandardMap.transform({:ok, nil, {5, -1, -1, 4}})
assert {:ok, 3, {6, 1, -1, 4}} = StandardMap.transform({:ok, nil, {6, 1, -1, 4}})
assert {:ok, 12, {9, -1, 1, 4}} = StandardMap.transform({:ok, nil, {9, -1, 1, 4}})
assert {:ok, 15, {10, 1, 1, 4}} = StandardMap.transform({:ok, nil, {10, 1, 1, 4}})
end
test "super big boggle inner corners are valid" do
assert {:ok, 0, {7, -1, -1, 6}} = StandardMap.transform({:ok, nil, {7, -1, -1, 6}})
assert {:ok, 5, {10, 1, -1, 6}} = StandardMap.transform({:ok, nil, {10, 1, -1, 6}})
assert {:ok, 30, {25, -1, 1, 6}} = StandardMap.transform({:ok, nil, {25, -1, 1, 6}})
assert {:ok, 35, {28, 1, 1, 6}} = StandardMap.transform({:ok, nil, {28, 1, 1, 6}})
end
test "boggle upper left outer corner fail" do
assert {:error, _, _} = StandardMap.transform({:ok, nil, {0, -1, 0, 4}})
assert {:error, _, _} = StandardMap.transform({:ok, nil, {0, -1, -1, 4}})
assert {:error, _, _} = StandardMap.transform({:ok, nil, {0, 0, -1, 4}})
end
test "boggle lower right outer corner fail" do
assert {:error, _, _} = StandardMap.transform({:ok, nil, {15, 1, 0, 4}})
assert {:error, _, _} = StandardMap.transform({:ok, nil, {15, 1, 1, 4}})
assert {:error, _, _} = StandardMap.transform({:ok, nil, {15, 0, 1, 4}})
end
end
| 45.416667 | 88 | 0.581651 |
9e86a81b87f5f709fd5f80ab42338ca575739bde | 729 | exs | Elixir | config/releases.exs | elixir-berlin/juntos | 64dd05888f357cf0c74da11d1eda69bab7f38e95 | [
"MIT"
] | 1 | 2019-11-15T15:39:24.000Z | 2019-11-15T15:39:24.000Z | config/releases.exs | elixir-berlin/juntos | 64dd05888f357cf0c74da11d1eda69bab7f38e95 | [
"MIT"
] | 166 | 2020-06-30T16:07:48.000Z | 2021-11-25T00:02:24.000Z | config/releases.exs | elixir-berlin/juntos | 64dd05888f357cf0c74da11d1eda69bab7f38e95 | [
"MIT"
] | null | null | null | import Config
database_url = System.fetch_env!("DATABASE_URL")
secret_key_base = System.fetch_env!("SECRET_KEY_BASE")
config :juntos, Juntos.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
config :juntos, JuntosWeb.Endpoint,
url: [scheme: "https", host: System.get_env("HOSTNAME"), port: 443],
http: [
port: String.to_integer(System.get_env("PORT") || "4000"),
transport_options: [socket_opts: [:inet6]]
],
secret_key_base: secret_key_base
config :juntos, JuntosWeb.Endpoint, server: true
config :ueberauth, Ueberauth.Strategy.Github.OAuth,
client_id: System.get_env("GITHUB_CLIENT_ID"),
client_secret: System.get_env("GITHUB_CLIENT_SECRET")
| 30.375 | 70 | 0.737997 |
9e86b2a9b1286c9371c3faa2617ebb98e9c9cc5e | 1,026 | exs | Elixir | test/multiverse_test.exs | ityonemo/state_server | 1e119970e20abb68fff13d449e95e3bf66298668 | [
"MIT"
] | 8 | 2019-08-31T00:31:58.000Z | 2021-06-11T22:12:05.000Z | test/multiverse_test.exs | ityonemo/state_server | 1e119970e20abb68fff13d449e95e3bf66298668 | [
"MIT"
] | 39 | 2019-09-07T21:29:09.000Z | 2020-05-05T15:01:30.000Z | test/multiverse_test.exs | ityonemo/state_server | 1e119970e20abb68fff13d449e95e3bf66298668 | [
"MIT"
] | 2 | 2020-01-04T05:44:25.000Z | 2020-01-19T21:44:41.000Z | defmodule StateServerTest.MultiverseTest do
# tests to make sure we can imbue StateServer with
# the ability to forward its caller.
use Multiverses, with: DynamicSupervisor
defmodule TestServer do
use StateServer, on: []
def start_link(opts) do
StateServer.start_link(__MODULE__, nil, opts)
end
@impl true
def init(state), do: {:ok, state}
@impl true
def handle_call(:callers, _, _state, _data) do
{:reply, Process.get(:"$callers")}
end
end
use ExUnit.Case, async: true
test "basic state_server caller functionality" do
{:ok, srv} = TestServer.start_link(forward_callers: true)
assert [self()] == GenServer.call(srv, :callers)
end
test "dynamically supervised StateServer gets correct caller" do
{:ok, sup} = DynamicSupervisor.start_link(strategy: :one_for_one)
{:ok, child} = DynamicSupervisor.start_child(sup, {TestServer, [forward_callers: true]})
Process.sleep(20)
assert self() in GenServer.call(child, :callers)
end
end
| 25.02439 | 92 | 0.695906 |
9e86bcd2c8ef072e4e1601a357d3fd481c66a34e | 4,347 | ex | Elixir | lib/venture_bot/client.ex | oestrich/venture_bot | 366a4726f3c952e2c850c79f1b36fa054b5f7a24 | [
"MIT"
] | 4 | 2018-11-08T17:59:44.000Z | 2019-09-13T15:10:50.000Z | lib/venture_bot/client.ex | oestrich/venture_bot | 366a4726f3c952e2c850c79f1b36fa054b5f7a24 | [
"MIT"
] | null | null | null | lib/venture_bot/client.ex | oestrich/venture_bot | 366a4726f3c952e2c850c79f1b36fa054b5f7a24 | [
"MIT"
] | null | null | null | defmodule VentureBot.Client do
use GenServer
require Logger
alias VentureBot.Client.Bot
alias VentureBot.Parser
def start_link(_) do
GenServer.start_link(__MODULE__, [])
end
def push(pid, string) do
send(pid, {:send, string})
end
def init(_) do
Logger.info("Starting bot")
{:ok, %{active: false, name: nil}, {:continue, :connect}}
end
def handle_continue(:connect, state) do
{:ok, socket} = :gen_tcp.connect('localhost', 5555, [:binary, {:packet, 0}])
{:noreply, Map.put(state, :socket, socket)}
end
def handle_info({:tcp, _port, data}, state) do
string = data |> Parser.clean_string()
{:ok, state} = Bot.process(state, string)
{:noreply, state}
end
def handle_info({:send, string}, state) do
Logger.info("[#{state.name}] Sending: " <> string)
:gen_tcp.send(state.socket, string <> "\n")
{:noreply, state}
end
defmodule Bot do
@exits_regex ~r/Exits: (?<exits>[\w\(\), ]+)\n/
@races_regex ~r/(?<options>options are:(?:\n\t- \w+)+)/
alias VentureBot.Client
def process(state = %{active: false}, string) do
#IO.puts(string)
cond do
login_name?(string) ->
Logger.info("Logging in")
Client.push(self(), "create")
{:ok, state}
login_link?(string) ->
Logger.info("Found the login link")
{:ok, state}
create_name_prompt?(string) ->
Logger.info("Picking a name")
name = random_name()
Client.push(self(), name)
{:ok, %{state | name: name}}
create_races_prompt?(string) ->
Logger.info("Picking a race")
captures = Regex.named_captures(@races_regex, string)
[_ | options] = String.split(captures["options"], "\n")
race =
options
|> Enum.map(&String.replace(&1, "-", ""))
|> Enum.map(&String.trim/1)
|> Enum.shuffle()
|> List.first
Client.push(self(), race)
{:ok, state}
create_email_prompt?(string) ->
Logger.info("Skipping email")
Client.push(self(), "")
{:ok, state}
create_password_prompt?(string) ->
Logger.info("Sending a password")
Client.push(self(), "password")
{:ok, state}
press_enter?(string) ->
Logger.info("Sending enter")
Client.push(self(), "")
{:ok, %{state | active: true}}
true ->
{:ok, state}
end
end
def process(state = %{active: true}, string) do
#IO.puts string
case exits?(string) do
true ->
Logger.debug("Found exits")
captures = Regex.named_captures(@exits_regex, string)
case captures do
%{"exits" => exits} ->
exit =
exits
|> String.split(",")
|> Enum.map(&String.replace(&1, "(closed)", ""))
|> Enum.map(&String.replace(&1, "(open)", ""))
|> Enum.map(&String.trim/1)
|> Enum.shuffle()
|> List.first()
delay = Enum.random(3_500..7_000)
Process.send_after(self(), {:send, exit}, delay)
_ ->
delay = Enum.random(3_500..7_000)
Process.send_after(self(), {:send, "look"}, delay)
end
{:ok, state}
false ->
{:ok, state}
end
end
defp login_name?(string) do
Regex.match?(~r/your player name/, string)
end
defp login_link?(string) do
Regex.match?(~r/http:\/\/.+\n/, string)
end
defp create_name_prompt?(string) do
Regex.match?(~r/\nName:/, string)
end
defp create_races_prompt?(string) do
Regex.match?(@races_regex, string)
end
defp create_email_prompt?(string) do
Regex.match?(~r/Email \(optional, enter for blank\):/, string)
end
defp create_password_prompt?(string) do
Regex.match?(~r/\nPassword:/, string)
end
defp press_enter?(string) do
Regex.match?(~r/\[Press enter to continue\]/, string)
end
defp exits?(string) do
Regex.match?(~r/Exits:/, string)
end
defp random_name() do
UUID.uuid4()
|> String.slice(0..11)
|> String.replace("-", "")
end
end
end
| 24.698864 | 80 | 0.534392 |
9e86c0b8f6fc1e925848cc8c049b036b80a191b0 | 3,654 | exs | Elixir | samples/benchmarks.exs | zacky1972/monochrome_filter | bcf9acdc3a5981910d5e6ee31f39f5ed4850d784 | [
"Apache-2.0"
] | null | null | null | samples/benchmarks.exs | zacky1972/monochrome_filter | bcf9acdc3a5981910d5e6ee31f39f5ed4850d784 | [
"Apache-2.0"
] | null | null | null | samples/benchmarks.exs | zacky1972/monochrome_filter | bcf9acdc3a5981910d5e6ee31f39f5ed4850d784 | [
"Apache-2.0"
] | null | null | null | Application.put_env(:exla, :clients,
default: [platform: :host],
cuda: [platform: :cuda]
)
defmodule Mono do
import Nx.Defn
@defn_compiler EXLA
defn host32(n), do: MonochromeFilter.monochrome_filter_32(n)
@defn_compiler EXLA
defn host16(n), do: MonochromeFilter.monochrome_filter_16(n)
@defn_compiler {EXLA, client: :cuda}
defn cuda32(n), do: MonochromeFilter.monochrome_filter_32(n)
@defn_compiler {EXLA, client: :cuda}
defn cuda16(n), do: MonochromeFilter.monochrome_filter_16(n)
@defn_compiler {EXLA, client: :cuda, run_options: [keep_on_device: true]}
defn cuda_keep32(n), do: MonochromeFilter.monochrome_filter_32(n)
@defn_compiler {EXLA, client: :cuda, run_options: [keep_on_device: true]}
defn cuda_keep16(n), do: MonochromeFilter.monochrome_filter_16(n)
defn sub_abs_max(a, b) do
Nx.subtract(a, b)
|> Nx.as_type({:s, 8})
|> Nx.abs()
|> Nx.reduce_max()
end
def assert_result(expected, actual, message) do
if Nx.to_scalar(sub_abs_max(expected, actual)) > 1 do
IO.puts "#{Nx.to_scalar(sub_abs_max(expected, actual))}: #{message}"
end
end
defp cuda_sub() do
System.cmd("opencv_version", ["--verbose"])
|> elem(0)
|> String.split("\n")
|> Enum.filter(& String.match?(&1, ~r/CUDA.*YES/))
|> Enum.count()
end
def cuda?(), do: cuda_sub() > 0
end
input = MonochromeFilter.init_random_pixel()
result = MonochromeFilter.monochrome_filter_32(input)
Mono.assert_result(result, MonochromeFilter.monochrome_filter_16(input), "MonochromeFilter.monochrome_filter_16")
Mono.assert_result(result, MonochromeFilterNif.monochrome32(input), "MonochromeFilterNif.monochrome32")
Mono.assert_result(result, MonochromeFilterNif.monochrome32i(input), "MonochromeFilterNif.monochrome32i")
Mono.assert_result(result, MonochromeFilterNif.monochrome32ip(input), "MonochromeFilterNif.monochrome32ip")
Mono.assert_result(result, MonochromeFilterNif.monochrome16(input), "MonochromeFilterNif.monochrome16")
Mono.assert_result(result, MonochromeFilterNif.monochrome16i(input), "MonochromeFilterNif.monochrome16i")
Mono.assert_result(result, CvMonochrome.cv_monochrome(input), "CvMonochrome.cv_monochrome")
benches = %{
"Nx 32" => fn -> MonochromeFilter.monochrome_filter_32(input) end,
"Nx 16" => fn -> MonochromeFilter.monochrome_filter_16(input) end,
"nif 32" => fn -> MonochromeFilterNif.monochrome32(input) end,
"nif 32 intrinsics" => fn -> MonochromeFilterNif.monochrome32i(input) end,
"nif 32 intrinsics with pipeline" => fn -> MonochromeFilterNif.monochrome32ip(input) end,
"nif 16" => fn -> MonochromeFilterNif.monochrome16(input) end,
"nif 16 intrinsics" => fn -> MonochromeFilterNif.monochrome16i(input) end,
"xla jit-cpu 32" => fn -> Mono.host32(input) end,
"xla jit-cpu 16" => fn -> Mono.host16(input) end,
"openCV cpu" => fn -> CvMonochrome.cv_monochrome(input) end
}
benches =
if System.get_env("EXLA_TARGET") == "cuda" do
di = Nx.backend_transfer(input, {EXLA.DeviceBackend, client: :cuda})
Map.merge(benches, %{
"xla jit-gpu 32" => fn -> Mono.cuda32(di) end,
"xla jit-gpu 16" => fn -> Mono.cuda16(di) end,
"xla jit-gpu keep 32" => fn -> Mono.cuda_keep32(di) end,
"xla jit-gpu keep 16" => fn -> Mono.cuda_keep16(di) end
})
else
benches
end
benches =
if Mono.cuda?() do
Mono.assert_result(result, CvMonochrome.cv_monochrome_gpu(input), "CvMonochrome.cv_monochrome_gpu")
Map.merge(benches, %{
"openCV gpu" => fn -> CvMonochrome.cv_monochrome_gpu(input) end
})
else
benches
end
Benchee.run(
benches,
time: 10,
memory_time: 2
) \
|> then(fn _ -> :ok end)
| 34.8 | 113 | 0.714559 |
9e86fdba21ccf59db9a16f10e26f9a8bc7ed9d2f | 2,087 | exs | Elixir | apps/api_web/test/api_web/views/stop_view_test.exs | lboyarsky/api | 7ecad79704d13ae6fa7f21d21bc47836c703ebf9 | [
"MIT"
] | null | null | null | apps/api_web/test/api_web/views/stop_view_test.exs | lboyarsky/api | 7ecad79704d13ae6fa7f21d21bc47836c703ebf9 | [
"MIT"
] | null | null | null | apps/api_web/test/api_web/views/stop_view_test.exs | lboyarsky/api | 7ecad79704d13ae6fa7f21d21bc47836c703ebf9 | [
"MIT"
] | 1 | 2019-09-09T20:40:13.000Z | 2019-09-09T20:40:13.000Z | defmodule ApiWeb.StopViewTest do
@moduledoc false
use ApiWeb.ConnCase, async: true
import Phoenix.View
import ApiWeb.StopView
alias ApiWeb.StopView
alias Model.Stop
@stop %Stop{
id: "72",
name: "Massachusetts Ave @ Pearl St",
description: "description",
latitude: 42.364915,
longitude: -71.103074,
municipality: "Cambridge",
on_street: "Massachusetts Avenue",
at_street: "Essex Street",
vehicle_type: 3
}
test "can do a basic rendering", %{conn: conn} do
rendered = render("index.json-api", data: @stop, conn: conn)["data"]
assert rendered["type"] == "stop"
assert rendered["id"] == @stop.id
assert rendered["attributes"] == %{
"name" => @stop.name,
"description" => @stop.description,
"latitude" => @stop.latitude,
"longitude" => @stop.longitude,
"municipality" => @stop.municipality,
"on_street" => @stop.on_street,
"at_street" => @stop.at_street,
"vehicle_type" => @stop.vehicle_type,
"address" => nil,
"location_type" => 0,
"platform_code" => nil,
"platform_name" => nil,
"wheelchair_boarding" => 0
}
end
test "encodes the self link to be URL safe", %{conn: conn} do
id = "River Works / GE Employees Only"
expected = "River%20Works%20%2F%20GE%20Employees%20Only"
stop = %Stop{id: id}
rendered = render(StopView, "index.json-api", data: stop, conn: conn)
assert rendered["data"]["links"]["self"] == "/stops/#{expected}"
end
describe "show.json-api" do
test "doesn't include a route with a single include=route query param", %{conn: conn} do
conn =
conn
|> Map.put(:params, %{"include" => "route"})
|> Phoenix.Controller.put_view(StopView)
|> ApiWeb.ApiControllerHelpers.split_include([])
stop = %Stop{}
rendered = render(StopView, "show.json-api", data: stop, conn: conn)
refute rendered["data"]["relationships"]["route"]
end
end
end
| 32.107692 | 92 | 0.591759 |
9e86ffc04414fd3a991aa43dfdc75d842130125f | 48,124 | ex | Elixir | lib/absinthe/schema/notation.ex | bmuller/absinthe | 5d41e37b0b1bee5e124b826f7157478955c5e9f1 | [
"MIT"
] | null | null | null | lib/absinthe/schema/notation.ex | bmuller/absinthe | 5d41e37b0b1bee5e124b826f7157478955c5e9f1 | [
"MIT"
] | null | null | null | lib/absinthe/schema/notation.ex | bmuller/absinthe | 5d41e37b0b1bee5e124b826f7157478955c5e9f1 | [
"MIT"
] | null | null | null | defmodule Absinthe.Schema.Notation do
alias Absinthe.Blueprint.Schema
alias Absinthe.Utils
@moduledoc """
Provides a set of macro's to use when creating a schema. Especially useful
when moving definitions out into a different module than the schema itself.
## Example
defmodule MyAppWeb.Schema.Types do
use Absinthe.Schema.Notation
object :item do
field :id, :id
field :name, :string
end
# ...
end
"""
Module.register_attribute(__MODULE__, :placement, accumulate: true)
defmacro __using__(import_opts \\ [only: :macros]) do
Module.register_attribute(__CALLER__.module, :absinthe_blueprint, accumulate: true)
Module.register_attribute(__CALLER__.module, :absinthe_desc, accumulate: true)
put_attr(__CALLER__.module, %Absinthe.Blueprint{schema: __CALLER__.module})
Module.put_attribute(__CALLER__.module, :absinthe_scope_stack, [:schema])
Module.put_attribute(__CALLER__.module, :absinthe_scope_stack_stash, [])
quote do
import Absinthe.Resolution.Helpers,
only: [
async: 1,
async: 2,
batch: 3,
batch: 4
]
Module.register_attribute(__MODULE__, :__absinthe_type_import__, accumulate: true)
@desc nil
import unquote(__MODULE__), unquote(import_opts)
@before_compile unquote(__MODULE__)
end
end
### Macro API ###
@placement {:config, [under: [:field]]}
@doc """
Configure a subscription field.
The first argument to the config function is the field arguments passed in the subscription.
The second argument is an `Absinthe.Resolution` struct, which includes information
like the context and other execution data.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```elixir
config fn args, %{context: context} ->
if authorized?(context) do
{:ok, topic: args.client_id}
else
{:error, "unauthorized"}
end
end
```
Alternatively can provide a list of topics:
```elixir
config fn _, _ ->
{:ok, topic: ["topic_one", "topic_two", "topic_three"]}
end
```
Using `context_id` option to allow de-duplication of updates:
```elixir
config fn _, %{context: context} ->
if authorized?(context) do
{:ok, topic: "topic_one", context_id: "authorized"}
else
{:ok, topic: "topic_one", context_id: "not-authorized"}
end
end
```
See `Absinthe.Schema.subscription/1` for details
"""
defmacro config(config_fun) do
__CALLER__
|> recordable!(:config, @placement[:config])
|> record_config!(config_fun)
end
@placement {:trigger, [under: [:field]]}
@doc """
Sets triggers for a subscription, and configures which topics to publish to when that subscription
is triggered.
A trigger is the name of a mutation. When that mutation runs, data is pushed to the clients
who are subscribed to the subscription.
A subscription can have many triggers, and a trigger can push to many topics.
## Placement
#{Utils.placement_docs(@placement)}
## Example
```elixir
mutation do
field :gps_event, :gps_event
field :user_checkin, :user
end
subscription do
field :location_update, :user do
arg :user_id, non_null(:id)
config fn args, _ ->
{:ok, topic: args.user_id}
end
trigger :gps_event, topic: fn gps_event ->
gps_event.user_id
end
# Trigger on a list of mutations
trigger [:user_checkin], topic: fn user ->
# Returning a list of topics triggers the subscription for each of the topics in the list.
[user.id, user.friend.id]
end
end
end
```
Trigger functions are only called once per event, so database calls within
them do not present a significant burden.
See the `Absinthe.Schema.subscription/2` macro docs for additional details
"""
defmacro trigger(mutations, attrs) do
__CALLER__
|> recordable!(:trigger, @placement[:trigger])
|> record_trigger!(List.wrap(mutations), attrs)
end
# OBJECT
@placement {:object, [toplevel: true]}
@doc """
Define an object type.
Adds an `Absinthe.Type.Object` to your schema.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
Basic definition:
```
object :car do
# ...
end
```
Providing a custom name:
```
object :car, name: "CarType" do
# ...
end
```
"""
@reserved_identifiers ~w(query mutation subscription)a
defmacro object(identifier, attrs \\ [], block)
defmacro object(identifier, _attrs, _block) when identifier in @reserved_identifiers do
raise Absinthe.Schema.Notation.Error,
"Invalid schema notation: cannot create an `object` " <>
"with reserved identifier `#{identifier}`"
end
defmacro object(identifier, attrs, do: block) do
{attrs, block} =
case Keyword.pop(attrs, :meta) do
{nil, attrs} ->
{attrs, block}
{meta, attrs} ->
meta_ast =
quote do
meta unquote(meta)
end
block = [meta_ast, block]
{attrs, block}
end
__CALLER__
|> recordable!(:object, @placement[:object])
|> record!(
Schema.ObjectTypeDefinition,
identifier,
attrs |> Keyword.update(:description, nil, &wrap_in_unquote/1),
block
)
end
@placement {:interfaces, [under: [:object, :interface]]}
@doc """
Declare implemented interfaces for an object.
See also `interface/1`, which can be used for one interface,
and `interface/3`, used to define interfaces themselves.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
object :car do
interfaces [:vehicle, :branded]
# ...
end
```
"""
defmacro interfaces(ifaces) when is_list(ifaces) do
__CALLER__
|> recordable!(:interfaces, @placement[:interfaces])
|> record_interfaces!(ifaces)
end
@placement {:deprecate, [under: [:field]]}
@doc """
Mark a field as deprecated
In most cases you can simply pass the deprecate: "message" attribute. However
when using the block form of a field it can be nice to also use this macro.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
field :foo, :string do
deprecate "Foo will no longer be supported"
end
```
This is how to deprecate other things
```
field :foo, :string do
arg :bar, :integer, deprecate: "This isn't supported either"
end
enum :colors do
value :red
value :blue, deprecate: "This isn't supported"
end
```
"""
defmacro deprecate(msg) do
__CALLER__
|> recordable!(:deprecate, @placement[:deprecate])
|> record_deprecate!(msg)
end
@doc """
Declare an implemented interface for an object.
Adds an `Absinthe.Type.Interface` to your schema.
See also `interfaces/1`, which can be used for multiple interfaces,
and `interface/3`, used to define interfaces themselves.
## Examples
```
object :car do
interface :vehicle
# ...
end
```
"""
@placement {:interface_attribute, [under: [:object, :interface]]}
defmacro interface(identifier) do
__CALLER__
|> recordable!(:interface_attribute, @placement[:interface_attribute])
|> record_interface!(identifier)
end
# INTERFACES
@placement {:interface, [toplevel: true]}
@doc """
Define an interface type.
Adds an `Absinthe.Type.Interface` to your schema.
Also see `interface/1` and `interfaces/1`, which declare
that an object implements one or more interfaces.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
interface :vehicle do
field :wheel_count, :integer
end
object :rally_car do
field :wheel_count, :integer
interface :vehicle
end
```
"""
defmacro interface(identifier, attrs \\ [], do: block) do
__CALLER__
|> recordable!(:interface, @placement[:interface])
|> record!(Schema.InterfaceTypeDefinition, identifier, attrs, block)
end
@placement {:resolve_type, [under: [:interface, :union]]}
@doc """
Define a type resolver for a union or interface.
See also:
* `Absinthe.Type.Interface`
* `Absinthe.Type.Union`
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
interface :entity do
# ...
resolve_type fn
%{employee_count: _}, _ ->
:business
%{age: _}, _ ->
:person
end
end
```
"""
defmacro resolve_type(func_ast) do
__CALLER__
|> recordable!(:resolve_type, @placement[:resolve_type])
|> record_resolve_type!(func_ast)
end
defp handle_field_attrs(attrs, caller) do
block =
for {identifier, arg_attrs} <- Keyword.get(attrs, :args, []) do
quote do
arg unquote(identifier), unquote(arg_attrs)
end
end
block =
case Keyword.get(attrs, :meta) do
nil ->
block
meta ->
meta_ast =
quote do
meta unquote(meta)
end
[meta_ast, block]
end
{func_ast, attrs} = Keyword.pop(attrs, :resolve)
block =
if func_ast do
[
quote do
resolve unquote(func_ast)
end
]
else
[]
end ++ block
attrs =
attrs
|> expand_ast(caller)
|> Keyword.delete(:args)
|> Keyword.delete(:meta)
|> Keyword.update(:description, nil, &wrap_in_unquote/1)
|> Keyword.update(:default_value, nil, &wrap_in_unquote/1)
|> handle_deprecate
{attrs, block}
end
defp handle_deprecate(attrs) do
deprecation = build_deprecation(attrs[:deprecate])
attrs
|> Keyword.delete(:deprecate)
|> Keyword.put(:deprecation, deprecation)
end
defp build_deprecation(msg) do
case msg do
true -> %Absinthe.Type.Deprecation{reason: nil}
reason when is_binary(reason) -> %Absinthe.Type.Deprecation{reason: reason}
_ -> nil
end
end
# FIELDS
@placement {:field, [under: [:input_object, :interface, :object]]}
@doc """
Defines a GraphQL field
See `field/4`
"""
defmacro field(identifier, attrs) when is_list(attrs) do
{attrs, block} = handle_field_attrs(attrs, __CALLER__)
__CALLER__
|> recordable!(:field, @placement[:field])
|> record!(Schema.FieldDefinition, identifier, attrs, block)
end
defmacro field(identifier, type) do
{attrs, block} = handle_field_attrs([type: type], __CALLER__)
__CALLER__
|> recordable!(:field, @placement[:field])
|> record!(Schema.FieldDefinition, identifier, attrs, block)
end
@doc """
Defines a GraphQL field
See `field/4`
"""
defmacro field(identifier, attrs, do: block) when is_list(attrs) do
{attrs, more_block} = handle_field_attrs(attrs, __CALLER__)
block = more_block ++ List.wrap(block)
__CALLER__
|> recordable!(:field, @placement[:field])
|> record!(Schema.FieldDefinition, identifier, attrs, block)
end
defmacro field(identifier, type, do: block) do
{attrs, _} = handle_field_attrs([type: type], __CALLER__)
__CALLER__
|> recordable!(:field, @placement[:field])
|> record!(Schema.FieldDefinition, identifier, attrs, block)
end
defmacro field(identifier, type, attrs) do
{attrs, block} = handle_field_attrs(Keyword.put(attrs, :type, type), __CALLER__)
__CALLER__
|> recordable!(:field, @placement[:field])
|> record!(Schema.FieldDefinition, identifier, attrs, block)
end
@doc """
Defines a GraphQL field.
## Placement
#{Utils.placement_docs(@placement)}
`query`, `mutation`, and `subscription` are
all objects under the covers, and thus you'll find `field` definitions under
those as well.
## Examples
```
field :id, :id
field :age, :integer, description: "How old the item is"
field :name, :string do
description "The name of the item"
end
field :location, type: :location
```
"""
defmacro field(identifier, type, attrs, do: block) do
attrs = Keyword.put(attrs, :type, type)
{attrs, more_block} = handle_field_attrs(attrs, __CALLER__)
block = more_block ++ List.wrap(block)
__CALLER__
|> recordable!(:field, @placement[:field])
|> record!(Schema.FieldDefinition, identifier, attrs, block)
end
@placement {:resolve, [under: [:field]]}
@doc """
Defines a resolve function for a field
Specify a 2 or 3 arity function to call when resolving a field.
You can either hard code a particular anonymous function, or have a function
call that returns a 2 or 3 arity anonymous function. See examples for more information.
Note that when using a hard coded anonymous function, the function will not
capture local variables.
### 3 Arity Functions
The first argument to the function is the parent entity.
```
{
user(id: 1) {
name
}
}
```
A resolution function on the `name` field would have the result of the `user(id: 1)` field
as its first argument. Top level fields have the `root_value` as their first argument.
Unless otherwise specified, this defaults to an empty map.
The second argument to the resolution function is the field arguments. The final
argument is an `Absinthe.Resolution` struct, which includes information like
the `context` and other execution data.
### 2 Arity Function
Exactly the same as the 3 arity version, but without the first argument (the parent entity)
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
query do
field :person, :person do
resolve &Person.resolve/2
end
end
```
```
query do
field :person, :person do
resolve fn %{id: id}, _ ->
{:ok, Person.find(id)}
end
end
end
```
```
query do
field :person, :person do
resolve lookup(:person)
end
end
def lookup(:person) do
fn %{id: id}, _ ->
{:ok, Person.find(id)}
end
end
```
"""
defmacro resolve(func_ast) do
__CALLER__
|> recordable!(:resolve, @placement[:resolve])
quote do
middleware Absinthe.Resolution, unquote(func_ast)
end
end
@placement {:complexity, [under: [:field]]}
@doc """
Set the complexity of a field
For a field, the first argument to the function you supply to `complexity/1` is the user arguments -- just as a field's resolver can use user arguments to resolve its value, the complexity function that you provide can use the same arguments to calculate the field's complexity.
The second argument passed to your complexity function is the sum of all the complexity scores of all the fields nested below the current field.
An optional third argument is passed an `Absinthe.Complexity` struct, which includes information
like the context passed to `Absinthe.run/3`.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
query do
field :people, list_of(:person) do
arg :limit, :integer, default_value: 10
complexity fn %{limit: limit}, child_complexity ->
# set complexity based on maximum number of items in the list and
# complexity of a child.
limit * child_complexity
end
end
end
```
"""
defmacro complexity(func_ast) do
__CALLER__
|> recordable!(:complexity, @placement[:complexity])
|> record_complexity!(func_ast)
end
@placement {:middleware, [under: [:field]]}
defmacro middleware(new_middleware, opts \\ []) do
__CALLER__
|> recordable!(:middleware, @placement[:middleware])
|> record_middleware!(new_middleware, opts)
end
@placement {:is_type_of, [under: [:object]]}
@doc """
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro is_type_of(func_ast) do
__CALLER__
|> recordable!(:is_type_of, @placement[:is_type_of])
|> record_is_type_of!(func_ast)
end
@placement {:arg, [under: [:directive, :field]]}
# ARGS
@doc """
Add an argument.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
field do
arg :size, :integer
arg :name, non_null(:string), description: "The desired name"
arg :public, :boolean, default_value: true
end
```
"""
defmacro arg(identifier, type, attrs) do
attrs = handle_arg_attrs(identifier, type, attrs)
__CALLER__
|> recordable!(:arg, @placement[:arg])
|> record!(Schema.InputValueDefinition, identifier, attrs, nil)
end
@doc """
Add an argument.
See `arg/3`
"""
defmacro arg(identifier, attrs) when is_list(attrs) do
attrs = handle_arg_attrs(identifier, nil, attrs)
__CALLER__
|> recordable!(:arg, @placement[:arg])
|> record!(Schema.InputValueDefinition, identifier, attrs, nil)
end
defmacro arg(identifier, type) do
attrs = handle_arg_attrs(identifier, type, [])
__CALLER__
|> recordable!(:arg, @placement[:arg])
|> record!(Schema.InputValueDefinition, identifier, attrs, nil)
end
# SCALARS
@placement {:scalar, [toplevel: true]}
@doc """
Define a scalar type
A scalar type requires `parse/1` and `serialize/1` functions.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
scalar :time, description: "ISOz time" do
parse &Timex.parse(&1.value, "{ISOz}")
serialize &Timex.format!(&1, "{ISOz}")
end
```
"""
defmacro scalar(identifier, attrs, do: block) do
__CALLER__
|> recordable!(:scalar, @placement[:scalar])
|> record_scalar!(identifier, attrs, block)
end
@doc """
Defines a scalar type
See `scalar/3`
"""
defmacro scalar(identifier, do: block) do
__CALLER__
|> recordable!(:scalar, @placement[:scalar])
|> record_scalar!(identifier, [], block)
end
defmacro scalar(identifier, attrs) do
__CALLER__
|> recordable!(:scalar, @placement[:scalar])
|> record_scalar!(identifier, attrs, nil)
end
@placement {:serialize, [under: [:scalar]]}
@doc """
Defines a serialization function for a `scalar` type
The specified `serialize` function is used on outgoing data. It should simply
return the desired external representation.
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro serialize(func_ast) do
__CALLER__
|> recordable!(:serialize, @placement[:serialize])
|> record_serialize!(func_ast)
end
@placement {:private,
[under: [:field, :object, :input_object, :enum, :scalar, :interface, :union]]}
@doc false
defmacro private(owner, key, value) do
__CALLER__
|> recordable!(:private, @placement[:private])
|> record_private!(owner, [{key, value}])
end
@placement {:meta,
[under: [:field, :object, :input_object, :enum, :scalar, :interface, :union]]}
@doc """
Defines a metadata key/value pair for a custom type.
For more info see `meta/1`
### Examples
```
meta :cache, false
```
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro meta(key, value) do
__CALLER__
|> recordable!(:meta, @placement[:meta])
|> record_private!(:meta, [{key, value}])
end
@doc """
Defines list of metadata's key/value pair for a custom type.
This is generally used to facilitate libraries that want to augment Absinthe
functionality
## Examples
```
object :user do
meta cache: true, ttl: 22_000
end
object :user, meta: [cache: true, ttl: 22_000] do
# ...
end
```
The meta can be accessed via the `Absinthe.Type.meta/2` function.
```
user_type = Absinthe.Schema.lookup_type(MyApp.Schema, :user)
Absinthe.Type.meta(user_type, :cache)
#=> true
Absinthe.Type.meta(user_type)
#=> [cache: true, ttl: 22_000]
```
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro meta(keyword_list) do
__CALLER__
|> recordable!(:meta, @placement[:meta])
|> record_private!(:meta, keyword_list)
end
@placement {:parse, [under: [:scalar]]}
@doc """
Defines a parse function for a `scalar` type
The specified `parse` function is used on incoming data to transform it into
an elixir datastructure.
It should return `{:ok, value}` or `:error`
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro parse(func_ast) do
__CALLER__
|> recordable!(:parse, @placement[:parse])
|> record_parse!(func_ast)
end
# DIRECTIVES
@placement {:directive, [toplevel: true]}
@doc """
Defines a directive
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
directive :mydirective do
arg :if, non_null(:boolean), description: "Skipped when true."
on [:field, :fragment_spread, :inline_fragment]
expand fn
%{if: true}, node ->
Blueprint.put_flag(node, :skip, __MODULE__)
_, node ->
node
end
end
```
"""
defmacro directive(identifier, attrs \\ [], do: block) do
__CALLER__
|> recordable!(:directive, @placement[:directive])
|> record_directive!(identifier, attrs, block)
end
@placement {:on, [under: [:directive]]}
@doc """
Declare a directive as operating an a AST node type
See `directive/2`
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro on(ast_node) do
__CALLER__
|> recordable!(:on, @placement[:on])
|> record_locations!(ast_node)
end
@placement {:expand, [under: [:directive]]}
@doc """
Define the expansion for a directive
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro expand(func_ast) do
__CALLER__
|> recordable!(:expand, @placement[:expand])
|> record_expand!(func_ast)
end
@placement {:repeatable, [under: [:directive]]}
@doc """
Set whether the directive can be applied multiple times
an entity.
If omitted, defaults to `false`
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro repeatable(bool) do
__CALLER__
|> recordable!(:repeatable, @placement[:repeatable])
|> record_repeatable!(bool)
end
# INPUT OBJECTS
@placement {:input_object, [toplevel: true]}
@doc """
Defines an input object
See `Absinthe.Type.InputObject`
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
input_object :contact_input do
field :email, non_null(:string)
end
```
"""
defmacro input_object(identifier, attrs \\ [], do: block) do
__CALLER__
|> recordable!(:input_object, @placement[:input_object])
|> record!(
Schema.InputObjectTypeDefinition,
identifier,
attrs |> Keyword.update(:description, nil, &wrap_in_unquote/1),
block
)
end
# UNIONS
@placement {:union, [toplevel: true]}
@doc """
Defines a union type
See `Absinthe.Type.Union`
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
union :search_result do
description "A search result"
types [:person, :business]
resolve_type fn
%Person{}, _ -> :person
%Business{}, _ -> :business
end
end
```
"""
defmacro union(identifier, attrs \\ [], do: block) do
__CALLER__
|> recordable!(:union, @placement[:union])
|> record!(
Schema.UnionTypeDefinition,
identifier,
attrs |> Keyword.update(:description, nil, &wrap_in_unquote/1),
block
)
end
@placement {:types, [under: [:union]]}
@doc """
Defines the types possible under a union type
See `union/3`
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro types(types) do
__CALLER__
|> recordable!(:types, @placement[:types])
|> record_types!(types)
end
# ENUMS
@placement {:enum, [toplevel: true]}
@doc """
Defines an enum type
## Placement
#{Utils.placement_docs(@placement)}
## Examples
Handling `RED`, `GREEN`, `BLUE` values from the query document:
```
enum :color do
value :red
value :green
value :blue
end
```
A given query document might look like:
```graphql
{
foo(color: RED)
}
```
Internally you would get an argument in elixir that looks like:
```elixir
%{color: :red}
```
If your return value is an enum, it will get serialized out as:
```json
{"color": "RED"}
```
You can provide custom value mappings. Here we use `r`, `g`, `b` values:
```
enum :color do
value :red, as: "r"
value :green, as: "g"
value :blue, as: "b"
end
```
"""
defmacro enum(identifier, attrs, do: block) do
attrs = handle_enum_attrs(attrs, __CALLER__)
__CALLER__
|> recordable!(:enum, @placement[:enum])
|> record!(Schema.EnumTypeDefinition, identifier, attrs, block)
end
@doc """
Defines an enum type
See `enum/3`
"""
defmacro enum(identifier, do: block) do
__CALLER__
|> recordable!(:enum, @placement[:enum])
|> record!(Schema.EnumTypeDefinition, identifier, [], block)
end
defmacro enum(identifier, attrs) do
attrs = handle_enum_attrs(attrs, __CALLER__)
__CALLER__
|> recordable!(:enum, @placement[:enum])
|> record!(Schema.EnumTypeDefinition, identifier, attrs, [])
end
defp handle_enum_attrs(attrs, env) do
attrs
|> expand_ast(env)
|> Keyword.update(:values, [], &[wrap_in_unquote(&1)])
|> Keyword.update(:description, nil, &wrap_in_unquote/1)
end
@placement {:value, [under: [:enum]]}
@doc """
Defines a value possible under an enum type
See `enum/3`
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro value(identifier, raw_attrs \\ []) do
attrs = expand_ast(raw_attrs, __CALLER__)
__CALLER__
|> recordable!(:value, @placement[:value])
|> record_value!(identifier, attrs)
end
# GENERAL ATTRIBUTES
@placement {:description, [toplevel: false]}
@doc """
Defines a description
This macro adds a description to any other macro which takes a block.
Note that you can also specify a description by using `@desc` above any item
that can take a description attribute.
## Placement
#{Utils.placement_docs(@placement)}
"""
defmacro description(text) do
__CALLER__
|> recordable!(:description, @placement[:description])
|> record_description!(text)
end
# TYPE UTILITIES
@doc """
Marks a type reference as non null
See `field/3` for examples
"""
defmacro non_null({:non_null, _, _}) do
raise Absinthe.Schema.Notation.Error,
"Invalid schema notation: `non_null` must not be nested"
end
defmacro non_null(type) do
%Absinthe.Blueprint.TypeReference.NonNull{of_type: expand_ast(type, __CALLER__)}
end
@doc """
Marks a type reference as a list of the given type
See `field/3` for examples
"""
defmacro list_of(type) do
%Absinthe.Blueprint.TypeReference.List{of_type: expand_ast(type, __CALLER__)}
end
@placement {:import_fields, [under: [:input_object, :interface, :object]]}
@doc """
Import fields from another object
## Example
```
object :news_queries do
field :all_links, list_of(:link)
field :main_story, :link
end
object :admin_queries do
field :users, list_of(:user)
field :pending_posts, list_of(:post)
end
query do
import_fields :news_queries
import_fields :admin_queries
end
```
Import fields can also be used on objects created inside other modules that you
have used import_types on.
```
defmodule MyApp.Schema.NewsTypes do
use Absinthe.Schema.Notation
object :news_queries do
field :all_links, list_of(:link)
field :main_story, :link
end
end
defmodule MyApp.Schema.Schema do
use Absinthe.Schema
import_types MyApp.Schema.NewsTypes
query do
import_fields :news_queries
# ...
end
end
```
"""
defmacro import_fields(source_criteria, opts \\ []) do
source_criteria = expand_ast(source_criteria, __CALLER__)
put_attr(__CALLER__.module, {:import_fields, {source_criteria, opts}})
end
@placement {:import_types, [toplevel: true]}
@doc """
Import types from another module
Very frequently your schema module will simply have the `query` and `mutation`
blocks, and you'll want to break out your other types into other modules. This
macro imports those types for use the current module.
To selectively import types you can use the `:only` and `:except` opts.
## Placement
#{Utils.placement_docs(@placement)}
## Examples
```
import_types MyApp.Schema.Types
import_types MyApp.Schema.Types.{TypesA, TypesB}
import_types MyApp.Schema.Types, only: [:foo]
import_types MyApp.Schema.Types, except: [:bar]
```
"""
defmacro import_types(type_module_ast, opts \\ []) do
env = __CALLER__
type_module_ast
|> Macro.expand(env)
|> do_import_types(env, opts)
end
@placement {:import_sdl, [toplevel: true]}
@type import_sdl_option :: {:path, String.t() | Macro.t()}
@doc """
Import types defined using the Schema Definition Language (SDL).
TODO: Explain handlers
## Placement
#{Utils.placement_docs(@placement)}
## Examples
Directly embedded SDL:
```
import_sdl \"""
type Query {
posts: [Post]
}
type Post {
title: String!
body: String!
}
\"""
```
Loaded from a file location (supporting recompilation on change):
```
import_sdl path: "/path/to/sdl.graphql"
```
TODO: Example for dynamic loading during init
"""
@spec import_sdl([import_sdl_option(), ...]) :: Macro.t()
defmacro import_sdl(opts) when is_list(opts) do
__CALLER__
|> do_import_sdl(nil, opts)
end
@spec import_sdl(String.t() | Macro.t(), [import_sdl_option()]) :: Macro.t()
defmacro import_sdl(sdl, opts \\ []) do
__CALLER__
|> do_import_sdl(sdl, opts)
end
defmacro values(values) do
__CALLER__
|> record_values!(values)
end
### Recorders ###
#################
@scoped_types [
Schema.ObjectTypeDefinition,
Schema.FieldDefinition,
Schema.ScalarTypeDefinition,
Schema.EnumTypeDefinition,
Schema.EnumValueDefinition,
Schema.InputObjectTypeDefinition,
Schema.InputValueDefinition,
Schema.UnionTypeDefinition,
Schema.InterfaceTypeDefinition,
Schema.DirectiveDefinition
]
def record!(env, type, identifier, attrs, block) when type in @scoped_types do
attrs = expand_ast(attrs, env)
scoped_def(env, type, identifier, attrs, block)
end
def handle_arg_attrs(identifier, type, raw_attrs) do
raw_attrs
|> Keyword.put_new(:name, to_string(identifier))
|> Keyword.put_new(:type, type)
|> Keyword.update(:description, nil, &wrap_in_unquote/1)
|> Keyword.update(:default_value, nil, &wrap_in_unquote/1)
|> handle_deprecate
end
@doc false
# Record a directive expand function in the current scope
def record_expand!(env, func_ast) do
put_attr(env.module, {:expand, func_ast})
end
@doc false
def record_repeatable!(env, bool) do
put_attr(env.module, {:repeatable, bool})
end
@doc false
# Record directive AST nodes in the current scope
def record_locations!(env, locations) do
locations = expand_ast(locations, env)
put_attr(env.module, {:locations, List.wrap(locations)})
end
@doc false
# Record a directive
def record_directive!(env, identifier, attrs, block) do
attrs =
attrs
|> Keyword.put(:identifier, identifier)
|> Keyword.put_new(:name, to_string(identifier))
|> Keyword.update(:description, nil, &wrap_in_unquote/1)
scoped_def(env, Schema.DirectiveDefinition, identifier, attrs, block)
end
@doc false
# Record a parse function in the current scope
def record_parse!(env, fun_ast) do
put_attr(env.module, {:parse, fun_ast})
end
@doc false
# Record private values
def record_private!(env, owner, keyword_list) when is_list(keyword_list) do
keyword_list = expand_ast(keyword_list, env)
put_attr(env.module, {:__private__, [{owner, keyword_list}]})
end
@doc false
# Record a serialize function in the current scope
def record_serialize!(env, fun_ast) do
put_attr(env.module, {:serialize, fun_ast})
end
@doc false
# Record a type checker in the current scope
def record_is_type_of!(env, func_ast) do
put_attr(env.module, {:is_type_of, func_ast})
# :ok
end
@doc false
# Record a complexity analyzer in the current scope
def record_complexity!(env, func_ast) do
put_attr(env.module, {:complexity, func_ast})
# :ok
end
@doc false
# Record a type resolver in the current scope
def record_resolve_type!(env, func_ast) do
put_attr(env.module, {:resolve_type, func_ast})
# :ok
end
@doc false
# Record an implemented interface in the current scope
def record_interface!(env, identifier) do
put_attr(env.module, {:interface, identifier})
# Scope.put_attribute(env.module, :interfaces, identifier, accumulate: true)
# Scope.recorded!(env.module, :attr, :interface)
# :ok
end
@doc false
# Record a deprecation in the current scope
def record_deprecate!(env, msg) do
msg = expand_ast(msg, env)
deprecation = build_deprecation(msg)
put_attr(env.module, {:deprecation, deprecation})
end
@doc false
# Record a list of implemented interfaces in the current scope
def record_interfaces!(env, ifaces) do
Enum.each(ifaces, &record_interface!(env, &1))
end
@doc false
# Record a list of member types for a union in the current scope
def record_types!(env, types) do
put_attr(env.module, {:types, types})
end
@doc false
# Record an enum type
def record_enum!(env, identifier, attrs, block) do
attrs = expand_ast(attrs, env)
attrs = Keyword.put(attrs, :identifier, identifier)
scoped_def(env, :enum, identifier, attrs, block)
end
@doc false
# Record a description in the current scope
def record_description!(env, text_block) do
text = wrap_in_unquote(text_block)
put_attr(env.module, {:desc, text})
end
@doc false
# Record a scalar
def record_scalar!(env, identifier, attrs, block_or_nil) do
record!(
env,
Schema.ScalarTypeDefinition,
identifier,
attrs |> Keyword.update(:description, nil, &wrap_in_unquote/1),
block_or_nil
)
end
def handle_enum_value_attrs(identifier, raw_attrs, env) do
value = Keyword.get(raw_attrs, :as, identifier)
raw_attrs
|> expand_ast(env)
|> Keyword.put(:identifier, identifier)
|> Keyword.put(:value, wrap_in_unquote(value))
|> Keyword.put_new(:name, String.upcase(to_string(identifier)))
|> Keyword.delete(:as)
|> Keyword.update(:description, nil, &wrap_in_unquote/1)
|> handle_deprecate
end
@doc false
# Record an enum value in the current scope
def record_value!(env, identifier, raw_attrs) do
attrs = handle_enum_value_attrs(identifier, raw_attrs, env)
record!(env, Schema.EnumValueDefinition, identifier, attrs, [])
end
@doc false
# Record an enum value in the current scope
def record_values!(env, values) do
values =
values
|> expand_ast(env)
|> wrap_in_unquote
put_attr(env.module, {:values, values})
end
def record_config!(env, fun_ast) do
put_attr(env.module, {:config, fun_ast})
end
def record_trigger!(env, mutations, attrs) do
for mutation <- mutations do
put_attr(env.module, {:trigger, {mutation, attrs}})
end
end
def record_middleware!(env, new_middleware, opts) do
new_middleware =
case expand_ast(new_middleware, env) do
{module, fun} ->
{:{}, [], [{module, fun}, opts]}
atom when is_atom(atom) ->
case Atom.to_string(atom) do
"Elixir." <> _ ->
{:{}, [], [{atom, :call}, opts]}
_ ->
{:{}, [], [{env.module, atom}, opts]}
end
val ->
val
end
put_attr(env.module, {:middleware, [new_middleware]})
end
# We wrap the value (from the user) in an `unquote` call, so that when the schema `blueprint` is
# placed into `__absinthe_blueprint__` via `unquote(Macro.escape(blueprint, unquote: true))` the
# value gets unquoted. This allows us to evaluate function calls in the scope of the schema
# module.
defp wrap_in_unquote(value) do
{:unquote, [], [value]}
end
# ------------------------------
@doc false
defmacro pop() do
module = __CALLER__.module
popped = pop_stack(module, :absinthe_scope_stack_stash)
push_stack(module, :absinthe_scope_stack, popped)
put_attr(__CALLER__.module, :pop)
end
@doc false
defmacro stash() do
module = __CALLER__.module
popped = pop_stack(module, :absinthe_scope_stack)
push_stack(module, :absinthe_scope_stack_stash, popped)
put_attr(module, :stash)
end
@doc false
defmacro close_scope() do
put_attr(__CALLER__.module, :close)
pop_stack(__CALLER__.module, :absinthe_scope_stack)
end
def put_reference(attrs, env) do
Keyword.put(attrs, :__reference__, build_reference(env))
end
def build_reference(env) do
%{
module: env.module,
location: %{
file: env.file,
line: env.line
}
}
end
@scope_map %{
Schema.ObjectTypeDefinition => :object,
Schema.FieldDefinition => :field,
Schema.ScalarTypeDefinition => :scalar,
Schema.EnumTypeDefinition => :enum,
Schema.EnumValueDefinition => :value,
Schema.InputObjectTypeDefinition => :input_object,
Schema.InputValueDefinition => :arg,
Schema.UnionTypeDefinition => :union,
Schema.InterfaceTypeDefinition => :interface,
Schema.DirectiveDefinition => :directive
}
defp scoped_def(caller, type, identifier, attrs, body) do
attrs =
attrs
|> Keyword.put(:identifier, identifier)
|> Keyword.put_new(:name, default_name(type, identifier))
|> Keyword.put(:module, caller.module)
|> put_reference(caller)
definition = struct!(type, attrs)
ref = put_attr(caller.module, definition)
push_stack(caller.module, :absinthe_scope_stack, Map.fetch!(@scope_map, type))
[
get_desc(ref),
body,
quote(do: unquote(__MODULE__).close_scope())
]
end
defp get_desc(ref) do
quote do
unquote(__MODULE__).put_desc(__MODULE__, unquote(ref))
end
end
defp push_stack(module, key, val) do
stack = Module.get_attribute(module, key)
stack = [val | stack]
Module.put_attribute(module, key, stack)
end
defp pop_stack(module, key) do
[popped | stack] = Module.get_attribute(module, key)
Module.put_attribute(module, key, stack)
popped
end
def put_attr(module, thing) do
ref = :erlang.unique_integer()
Module.put_attribute(module, :absinthe_blueprint, {ref, thing})
ref
end
defp default_name(Schema.FieldDefinition, identifier) do
identifier
|> Atom.to_string()
end
defp default_name(_, identifier) do
identifier
|> Atom.to_string()
|> Absinthe.Utils.camelize()
end
defp do_import_types({{:., _, [{:__MODULE__, _, _}, :{}]}, _, modules_ast_list}, env, opts) do
for {_, _, leaf} <- modules_ast_list do
type_module = Module.concat([env.module | leaf])
do_import_types(type_module, env, opts)
end
end
defp do_import_types(
{{:., _, [{:__aliases__, _, [{:__MODULE__, _, _} | tail]}, :{}]}, _, modules_ast_list},
env,
opts
) do
root_module = Module.concat([env.module | tail])
for {_, _, leaf} <- modules_ast_list do
type_module = Module.concat([root_module | leaf])
do_import_types(type_module, env, opts)
end
end
defp do_import_types({{:., _, [{:__aliases__, _, root}, :{}]}, _, modules_ast_list}, env, opts) do
root_module = Module.concat(root)
root_module_with_alias = Keyword.get(env.aliases, root_module, root_module)
for {_, _, leaf} <- modules_ast_list do
type_module = Module.concat([root_module_with_alias | leaf])
do_import_types(type_module, env, opts)
end
end
defp do_import_types(module, env, opts) do
Module.put_attribute(env.module, :__absinthe_type_imports__, [
{module, opts} | Module.get_attribute(env.module, :__absinthe_type_imports__) || []
])
[]
end
@spec do_import_sdl(Macro.Env.t(), nil | String.t() | Macro.t(), [import_sdl_option()]) ::
Macro.t()
defp do_import_sdl(env, nil, opts) do
case Keyword.fetch(opts, :path) do
{:ok, path} ->
[
quote do
@__absinthe_import_sdl_path__ unquote(path)
end,
do_import_sdl(
env,
quote do
File.read!(@__absinthe_import_sdl_path__)
end,
opts
),
quote do
@external_resource @__absinthe_import_sdl_path__
end
]
:error ->
raise Absinthe.Schema.Notation.Error,
"Must provide `:path` option to `import_sdl` unless passing a raw SDL string as the first argument"
end
end
defp do_import_sdl(env, sdl, opts) do
ref = build_reference(env)
quote do
with {:ok, definitions} <-
unquote(__MODULE__).SDL.parse(
unquote(sdl),
__MODULE__,
unquote(Macro.escape(ref)),
unquote(Macro.escape(opts))
) do
@__absinthe_sdl_definitions__ definitions ++
(Module.get_attribute(
__MODULE__,
:__absinthe_sdl_definitions__
) || [])
else
{:error, error} ->
raise Absinthe.Schema.Notation.Error, "`import_sdl` could not parse SDL:\n#{error}"
end
end
end
def put_desc(module, ref) do
Module.put_attribute(module, :absinthe_desc, {ref, Module.get_attribute(module, :desc)})
Module.put_attribute(module, :desc, nil)
end
def noop(_desc) do
:ok
end
defmacro __before_compile__(env) do
module_attribute_descs =
env.module
|> Module.get_attribute(:absinthe_desc)
|> Map.new()
attrs =
env.module
|> Module.get_attribute(:absinthe_blueprint)
|> List.insert_at(0, :close)
|> reverse_with_descs(module_attribute_descs)
imports =
(Module.get_attribute(env.module, :__absinthe_type_imports__) || [])
|> Enum.uniq()
|> Enum.map(fn
module when is_atom(module) -> {module, []}
other -> other
end)
schema_def = %Schema.SchemaDefinition{
imports: imports,
module: env.module,
__reference__: %{
location: %{file: env.file, line: 0}
}
}
blueprint =
attrs
|> List.insert_at(1, schema_def)
|> Absinthe.Blueprint.Schema.build()
# TODO: handle multiple schemas
[schema] = blueprint.schema_definitions
{schema, functions} = lift_functions(schema, env.module)
sdl_definitions =
(Module.get_attribute(env.module, :__absinthe_sdl_definitions__) || [])
|> List.flatten()
|> Enum.map(fn definition ->
Absinthe.Blueprint.prewalk(definition, fn
%{module: _} = node ->
%{node | module: env.module}
node ->
node
end)
end)
{sdl_directive_definitions, sdl_type_definitions} =
Enum.split_with(sdl_definitions, fn
%Absinthe.Blueprint.Schema.DirectiveDefinition{} ->
true
_ ->
false
end)
schema =
schema
|> Map.update!(:type_definitions, &(sdl_type_definitions ++ &1))
|> Map.update!(:directive_definitions, &(sdl_directive_definitions ++ &1))
blueprint = %{blueprint | schema_definitions: [schema]}
quote do
unquote(__MODULE__).noop(@desc)
def __absinthe_blueprint__ do
unquote(Macro.escape(blueprint, unquote: true))
end
unquote_splicing(functions)
end
end
def lift_functions(schema, origin) do
Absinthe.Blueprint.prewalk(schema, [], &lift_functions(&1, &2, origin))
end
def lift_functions(node, acc, origin) do
{node, ast} = functions_for_type(node, origin)
{node, ast ++ acc}
end
defp functions_for_type(%Schema.FieldDefinition{} = type, origin) do
grab_functions(
origin,
type,
{Schema.FieldDefinition, type.function_ref},
Schema.functions(Schema.FieldDefinition)
)
end
defp functions_for_type(%module{identifier: identifier} = type, origin) do
grab_functions(origin, type, {module, identifier}, Schema.functions(module))
end
defp functions_for_type(type, _) do
{type, []}
end
def grab_functions(origin, type, identifier, attrs) do
{ast, type} =
Enum.flat_map_reduce(attrs, type, fn attr, type ->
value = Map.fetch!(type, attr)
ast =
quote do
def __absinthe_function__(unquote(identifier), unquote(attr)) do
unquote(value)
end
end
ref = {:ref, origin, identifier}
type =
Map.update!(type, attr, fn
value when is_list(value) ->
[ref]
_ ->
ref
end)
{[ast], type}
end)
{type, ast}
end
@doc false
def __ensure_middleware__([], _field, %{identifier: :subscription}) do
[Absinthe.Middleware.PassParent]
end
def __ensure_middleware__([], %{identifier: identifier}, _) do
[{Absinthe.Middleware.MapGet, identifier}]
end
# Don't install Telemetry middleware for Introspection fields
@introspection [Absinthe.Phase.Schema.Introspection, Absinthe.Type.BuiltIns.Introspection]
def __ensure_middleware__(middleware, %{definition: definition}, _object)
when definition in @introspection do
middleware
end
# Install Telemetry middleware
def __ensure_middleware__(middleware, _field, _object) do
[{Absinthe.Middleware.Telemetry, []} | middleware]
end
defp reverse_with_descs(attrs, descs, acc \\ [])
defp reverse_with_descs([], _descs, acc), do: acc
defp reverse_with_descs([{ref, attr} | rest], descs, acc) do
if desc = Map.get(descs, ref) do
reverse_with_descs(rest, descs, [attr, {:desc, desc} | acc])
else
reverse_with_descs(rest, descs, [attr | acc])
end
end
defp reverse_with_descs([attr | rest], descs, acc) do
reverse_with_descs(rest, descs, [attr | acc])
end
defp expand_ast(ast, env) do
Macro.prewalk(ast, fn
# We don't want to expand `@bla` into `Module.get_attribute(module, @bla)` because this
# function call will fail if the module is already compiled. Remember that the ast gets put
# into a generated `__absinthe_blueprint__` function which is called at "__after_compile__"
# time. This will be after a module has been compiled if there are multiple modules in the
# schema (in the case of an `import_types`).
#
# Also see test "test/absinthe/type/import_types_test.exs"
# "__absinthe_blueprint__ is callable at runtime even if there is a module attribute"
# and it's comment for more information
{:@, _, _} = node ->
node
{_, _, _} = node ->
Macro.expand(node, env)
node ->
node
end)
end
@doc false
# Ensure the provided operation can be recorded in the current environment,
# in the current scope context
def recordable!(env, usage, placement) do
[scope | _] = Module.get_attribute(env.module, :absinthe_scope_stack)
unless recordable?(placement, scope) do
raise Absinthe.Schema.Notation.Error, invalid_message(placement, usage)
end
env
end
defp recordable?([under: under], scope), do: scope in under
defp recordable?([toplevel: true], scope), do: scope == :schema
defp recordable?([toplevel: false], scope), do: scope != :schema
defp invalid_message([under: under], usage) do
allowed = under |> Enum.map(&"`#{&1}`") |> Enum.join(", ")
"Invalid schema notation: `#{usage}` must only be used within #{allowed}"
end
defp invalid_message([toplevel: true], usage) do
"Invalid schema notation: `#{usage}` must only be used toplevel"
end
defp invalid_message([toplevel: false], usage) do
"Invalid schema notation: `#{usage}` must not be used toplevel"
end
end
| 24.465684 | 280 | 0.64953 |
9e87375ee2c01cc69c3b10b34d810b1a020657ed | 197 | exs | Elixir | .formatter.exs | elixir-consul/consul_kv | 456234fd6c0fc8c66d37b760043c2f4337c55892 | [
"Apache-2.0"
] | null | null | null | .formatter.exs | elixir-consul/consul_kv | 456234fd6c0fc8c66d37b760043c2f4337c55892 | [
"Apache-2.0"
] | null | null | null | .formatter.exs | elixir-consul/consul_kv | 456234fd6c0fc8c66d37b760043c2f4337c55892 | [
"Apache-2.0"
] | null | null | null | # Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
locals_without_parens: [
# for maxwell
adapter: :*,
plug: :*
],
line_length: 100
]
| 17.909091 | 70 | 0.558376 |
9e87590be0cfec02f0757fddb6e469ea9cda8e94 | 1,805 | exs | Elixir | test/game/command/typo_test.exs | jgsmith/ex_venture | 546adaa8fe80d45a72fde6de8d8d6906902c12d4 | [
"MIT"
] | 2 | 2019-05-14T11:36:44.000Z | 2020-07-01T08:54:04.000Z | test/game/command/typo_test.exs | nickwalton/ex_venture | d8ff1b0181db03f9ddcb7610ae7ab533feecbfbb | [
"MIT"
] | null | null | null | test/game/command/typo_test.exs | nickwalton/ex_venture | d8ff1b0181db03f9ddcb7610ae7ab533feecbfbb | [
"MIT"
] | 1 | 2021-01-29T14:12:40.000Z | 2021-01-29T14:12:40.000Z | defmodule Game.Command.TypoTest do
use ExVenture.CommandCase
import Ecto.Query
alias Game.Command.Typo
alias Game.Session.State
setup do
state = %State{socket: :socket, state: "active", mode: "editor", commands: %{typo: %{lines: []}}}
%{state: state}
end
describe "creating a new typo" do
test "starting to create a new typo", %{state: state} do
{:editor, Typo, state} = Typo.run({"title"}, state)
assert state.commands.typo.title == "title"
assert state.commands.typo.lines == []
assert_socket_echo "enter in any more"
end
test "add lines together in the editor", %{state: state} do
{:update, state} = Typo.editor({:text, "line"}, state)
assert state.commands.typo.lines == ["line"]
end
test "complete the editor creates a typo", %{state: state} do
zone = create_zone()
room = create_room(zone)
user = create_user(%{name: "user", password: "password"})
character = create_character(user, %{name: "user"})
typo = %{title: "A typo", lines: ["line 1", "line 2"]}
state = %{state | commands: %{typo: typo}, character: character, save: %{room_id: room.id}}
{:update, state} = Typo.editor(:complete, state)
assert state.commands == %{}
assert Data.Typo |> select([b], count(b.id)) |> Repo.one == 1
end
test "complete the editor creates a typo - a typo with issues", %{state: state} do
typo = %{title: "A typo", lines: ["line 1", "line 2"]}
state = %{state | commands: %{typo: typo}, character: %{id: -1}, save: %{room_id: -1}}
{:update, state} = Typo.editor(:complete, state)
assert state.commands == %{}
assert Data.Typo |> select([b], count(b.id)) |> Repo.one == 0
assert_socket_echo "an issue"
end
end
end
| 30.083333 | 101 | 0.607202 |
9e876383fbc778df6220048bc84bbfae5192b04d | 2,726 | exs | Elixir | test/chit_chat_web/controllers/user_controller_test.exs | areski/ex-chitchat | 0ec14e9af6acba40d6708f924b76fb4fbe592dcf | [
"MIT"
] | 1 | 2021-09-10T16:49:36.000Z | 2021-09-10T16:49:36.000Z | test/chit_chat_web/controllers/user_controller_test.exs | areski/ex-chitchat | 0ec14e9af6acba40d6708f924b76fb4fbe592dcf | [
"MIT"
] | 2 | 2020-05-22T18:42:14.000Z | 2021-01-25T16:34:38.000Z | test/chit_chat_web/controllers/user_controller_test.exs | areski/ex-chitchat | 0ec14e9af6acba40d6708f924b76fb4fbe592dcf | [
"MIT"
] | null | null | null | defmodule ChitChatWeb.UserControllerTest do
use ChitChatWeb.ConnCase
alias ChitChat.Accounts
@create_attrs %{name: "some name", username: "some username"}
@update_attrs %{name: "some updated name", username: "some updated username"}
@invalid_attrs %{name: nil, username: nil}
def fixture(:user) do
{:ok, user} = Accounts.create_user(@create_attrs)
user
end
describe "index" do
test "lists all users", %{conn: conn} do
conn = get(conn, Routes.user_path(conn, :index))
assert html_response(conn, 200) =~ "Listing Users"
end
end
describe "new user" do
test "renders form", %{conn: conn} do
conn = get(conn, Routes.user_path(conn, :new))
assert html_response(conn, 200) =~ "New User"
end
end
describe "create user" do
test "redirects to show when data is valid", %{conn: conn} do
conn = post(conn, Routes.user_path(conn, :create), user: @create_attrs)
assert %{id: id} = redirected_params(conn)
assert redirected_to(conn) == Routes.user_path(conn, :show, id)
conn = get(conn, Routes.user_path(conn, :show, id))
assert html_response(conn, 200) =~ "Show User"
end
test "renders errors when data is invalid", %{conn: conn} do
conn = post(conn, Routes.user_path(conn, :create), user: @invalid_attrs)
assert html_response(conn, 200) =~ "New User"
end
end
describe "edit user" do
setup [:create_user]
test "renders form for editing chosen user", %{conn: conn, user: user} do
conn = get(conn, Routes.user_path(conn, :edit, user))
assert html_response(conn, 200) =~ "Edit User"
end
end
describe "update user" do
setup [:create_user]
test "redirects when data is valid", %{conn: conn, user: user} do
conn = put(conn, Routes.user_path(conn, :update, user), user: @update_attrs)
assert redirected_to(conn) == Routes.user_path(conn, :show, user)
conn = get(conn, Routes.user_path(conn, :show, user))
assert html_response(conn, 200) =~ "some updated name"
end
test "renders errors when data is invalid", %{conn: conn, user: user} do
conn = put(conn, Routes.user_path(conn, :update, user), user: @invalid_attrs)
assert html_response(conn, 200) =~ "Edit User"
end
end
describe "delete user" do
setup [:create_user]
test "deletes chosen user", %{conn: conn, user: user} do
conn = delete(conn, Routes.user_path(conn, :delete, user))
assert redirected_to(conn) == Routes.user_path(conn, :index)
assert_error_sent 404, fn ->
get(conn, Routes.user_path(conn, :show, user))
end
end
end
defp create_user(_) do
user = fixture(:user)
%{user: user}
end
end
| 30.629213 | 83 | 0.652238 |
9e876596b8be0217a8272e689d716e2b58b114c5 | 2,282 | ex | Elixir | lib/live_web.ex | donkeybanana/s2i-elixir | c13796ec3e66bd372d08f08a36f5704d6da98015 | [
"MIT"
] | null | null | null | lib/live_web.ex | donkeybanana/s2i-elixir | c13796ec3e66bd372d08f08a36f5704d6da98015 | [
"MIT"
] | null | null | null | lib/live_web.ex | donkeybanana/s2i-elixir | c13796ec3e66bd372d08f08a36f5704d6da98015 | [
"MIT"
] | null | null | null | defmodule LiveWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
This can be used in your application as:
use LiveWeb, :controller
use LiveWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused
on imports, uses and aliases.
Do NOT define functions inside the quoted expressions
below. Instead, define any helper function in modules
and import those modules here.
"""
def controller do
quote do
use Phoenix.Controller, namespace: LiveWeb
import Plug.Conn
import LiveWeb.Gettext
alias LiveWeb.Router.Helpers, as: Routes
end
end
def view do
quote do
use Phoenix.View,
root: "lib/live_web/templates",
namespace: LiveWeb
# Import convenience functions from controllers
import Phoenix.Controller,
only: [get_flash: 1, get_flash: 2, view_module: 1, view_template: 1]
# Include shared imports and aliases for views
unquote(view_helpers())
end
end
def live_view do
quote do
use Phoenix.LiveView,
layout: {LiveWeb.LayoutView, "live.html"}
unquote(view_helpers())
end
end
def live_component do
quote do
use Phoenix.LiveComponent
unquote(view_helpers())
end
end
def router do
quote do
use Phoenix.Router
import Plug.Conn
import Phoenix.Controller
import Phoenix.LiveView.Router
end
end
def channel do
quote do
use Phoenix.Channel
import LiveWeb.Gettext
end
end
defp view_helpers do
quote do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
# Import LiveView helpers (live_render, live_component, live_patch, etc)
import Phoenix.LiveView.Helpers
# Import basic rendering functionality (render, render_layout, etc)
import Phoenix.View
import LiveWeb.ErrorHelpers
import LiveWeb.Gettext
alias LiveWeb.Router.Helpers, as: Routes
end
end
@doc """
When used, dispatch to the appropriate controller/view/etc.
"""
defmacro __using__(which) when is_atom(which) do
apply(__MODULE__, which, [])
end
end
| 22.15534 | 78 | 0.676599 |
9e87693fc06efb2f3570823b7bc7c543d021b296 | 28,889 | ex | Elixir | lib/elixir/lib/code.ex | BlakeWilliams/elixir | f77cc2657cf981fdf819915f1ee15e69c3cd91ad | [
"Apache-2.0"
] | null | null | null | lib/elixir/lib/code.ex | BlakeWilliams/elixir | f77cc2657cf981fdf819915f1ee15e69c3cd91ad | [
"Apache-2.0"
] | null | null | null | lib/elixir/lib/code.ex | BlakeWilliams/elixir | f77cc2657cf981fdf819915f1ee15e69c3cd91ad | [
"Apache-2.0"
] | null | null | null | defmodule Code do
@moduledoc """
Utilities for managing code compilation, code evaluation and code loading.
This module complements Erlang's [`:code` module](http://www.erlang.org/doc/man/code.html)
to add behaviour which is specific to Elixir. Almost all of the functions in this module
have global side effects on the behaviour of Elixir.
"""
@doc """
Lists all loaded files.
## Examples
Code.require_file("../eex/test/eex_test.exs")
List.first(Code.loaded_files) =~ "eex_test.exs" #=> true
"""
def loaded_files do
:elixir_code_server.call(:loaded)
end
@doc """
Removes files from the loaded files list.
The modules defined in the file are not removed;
calling this function only removes them from the list,
allowing them to be required again.
## Examples
# Load EEx test code, unload file, check for functions still available
Code.load_file("../eex/test/eex_test.exs")
Code.unload_files(Code.loaded_files)
function_exported?(EExTest.Compiled, :before_compile, 0) #=> true
"""
def unload_files(files) do
:elixir_code_server.cast({:unload_files, files})
end
@doc """
Appends a path to the end of the Erlang VM code path list.
This is the list of directories the Erlang VM uses for
finding module code.
The path is expanded with `Path.expand/1` before being appended.
If this path does not exist, an error is returned.
## Examples
Code.append_path(".") #=> true
Code.append_path("/does_not_exist") #=> {:error, :bad_directory}
"""
def append_path(path) do
:code.add_pathz(to_charlist(Path.expand(path)))
end
@doc """
Prepends a path to the beginning of the Erlang VM code path list.
This is the list of directories the Erlang VM uses for finding
module code.
The path is expanded with `Path.expand/1` before being prepended.
If this path does not exist, an error is returned.
## Examples
Code.prepend_path(".") #=> true
Code.prepend_path("/does_not_exist") #=> {:error, :bad_directory}
"""
def prepend_path(path) do
:code.add_patha(to_charlist(Path.expand(path)))
end
@doc """
Deletes a path from the Erlang VM code path list. This is the list of
directories the Erlang VM uses for finding module code.
The path is expanded with `Path.expand/1` before being deleted. If the
path does not exist it returns `false`.
## Examples
Code.prepend_path(".")
Code.delete_path(".") #=> true
Code.delete_path("/does_not_exist") #=> false
"""
def delete_path(path) do
:code.del_path(to_charlist(Path.expand(path)))
end
@doc """
Evaluates the contents given by `string`.
The `binding` argument is a keyword list of variable bindings.
The `opts` argument is a keyword list of environment options.
**Warning**: `string` can be any Elixir code and will be executed with
the same privileges as the Erlang VM: this means that such code could
compromise the machine (for example by executing system commands).
Don't use `eval_string/3` with untrusted input (such as strings coming
from the network).
## Options
Options can be:
* `:file` - the file to be considered in the evaluation
* `:line` - the line on which the script starts
Additionally, the following scope values can be configured:
* `:aliases` - a list of tuples with the alias and its target
* `:requires` - a list of modules required
* `:functions` - a list of tuples where the first element is a module
and the second a list of imported function names and arity; the list
of function names and arity must be sorted
* `:macros` - a list of tuples where the first element is a module
and the second a list of imported macro names and arity; the list
of function names and arity must be sorted
Notice that setting any of the values above overrides Elixir's default
values. For example, setting `:requires` to `[]`, will no longer
automatically require the `Kernel` module; in the same way setting
`:macros` will no longer auto-import `Kernel` macros like `if/2`, `case/2`,
etc.
Returns a tuple of the form `{value, binding}`,
where `value` is the value returned from evaluating `string`.
If an error occurs while evaluating `string` an exception will be raised.
`binding` is a keyword list with the value of all variable bindings
after evaluating `string`. The binding key is usually an atom, but it
may be a tuple for variables defined in a different context.
## Examples
iex> Code.eval_string("a + b", [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line)
{3, [a: 1, b: 2]}
iex> Code.eval_string("c = a + b", [a: 1, b: 2], __ENV__)
{3, [a: 1, b: 2, c: 3]}
iex> Code.eval_string("a = a + b", [a: 1, b: 2])
{3, [a: 3, b: 2]}
For convenience, you can pass `__ENV__/0` as the `opts` argument and
all imports, requires and aliases defined in the current environment
will be automatically carried over:
iex> Code.eval_string("a + b", [a: 1, b: 2], __ENV__)
{3, [a: 1, b: 2]}
"""
def eval_string(string, binding \\ [], opts \\ [])
def eval_string(string, binding, %Macro.Env{} = env) do
{value, binding, _env, _scope} = :elixir.eval(to_charlist(string), binding, Map.to_list(env))
{value, binding}
end
def eval_string(string, binding, opts) when is_list(opts) do
validate_eval_opts(opts)
{value, binding, _env, _scope} = :elixir.eval(to_charlist(string), binding, opts)
{value, binding}
end
@doc """
Formats the given code `string`.
The formatter receives a string representing Elixir code and
returns iodata representing the formatted code according to
pre-defined rules.
## Options
* `:file` - the file which contains the string, used for error
reporting
* `:line` - the line the string starts, used for error reporting
* `:line_length` - the line length to aim for when formatting
the document. Defaults to 98.
* `:locals_without_parens` - a keyword list of name and arity
pairs that should be kept without parens whenever possible.
The arity may be the atom `:*`, which implies all arities of
that name. The formatter already includes a list of functions
and this option augments this list.
* `:rename_deprecated_at` - rename all known deprecated functions
at the given version to their non-deprecated equivalent. It
expects a valid `Version` which is usually the minimum Elixir
version supported by the project.
## Design principles
The formatter was designed under three principles.
First, the formatter never changes the semantics of the code by
default. This means the input AST and the output AST are equivalent.
Optional behaviour, such as `:rename_deprecated_at`, is allowed to
break this guarantee.
The second principle is to provide as little configuration as possible.
This eases the formatter adoption by removing contention points while
making sure a single style is followed consistently by the community as
a whole.
The formatter does not hard code names. The formatter will not behave
specially because a function is named `defmodule`, `def`, etc. This
principle mirrors Elixir's goal of being an extensible language where
developers can extend the language with new constructs as if they were
part of the language. When it is absolutely necessary to change behaviour
based on the name, this behaviour should be configurable, such as the
`:locals_without_parens` option.
## Keeping input formatting
The formatter respects the input format in some cases. Those are
listed below:
* Insignificant digits in numbers are kept as is. The formatter
however always inserts underscores for decimal numbers with more
than 5 digits and converts hexadecimal digits to uppercase
* Strings, charlists, atoms and sigils are kept as is. No character
is automatically escaped or unescaped. The choice of delimiter is
also respected from the input
* Newlines inside blocks are kept as in the input except for:
1) expressions that take multiple lines will always have an empty
line before and after and 2) empty lines are always squeezed
together into a single empty line
* The choice between `:do` keyword and `do/end` blocks is left
to the user
* Lists, tuples, bitstrings, maps, and structs will be broken into
multiple lines if they are followed by a newline in the opening
bracket and preceded by a new line in the closing bracket
* Pipeline operators, like `|>` and others with the same precedence,
will span multiple lines if they spanned multiple lines in the input
The behaviours above are not guaranteed. We may remove or add new
rules in the future. The goal of documenting them is to provide better
understanding on what to expect from the formatter.
## Forcing multi-line lists, maps, tuples, etc
As mentioned in the previous section, lists, tuples, bitstrings, maps,
and structs will be broken into multiple lines if they are followed by
a newline in the opening bracket and preceded by a new line in the
closing bracket lines. This means that
[foo,
bar]
will be formatted as
[foo, bar]
since there is no newline immediately after `[` and before `]`. The
following, however, will always be formatted in multiple lines:
[
foo,
bar
]
Keywords without the surrounding brackets in function calls and
typespecs can also be forced to be rendering on multiple lines
as long as each entry appear on its own line. For example:
defstruct name: nil,
age: 0
## Forcing line breaks for data structures after operators
Whenever there is a data structure that spans multiple lines after an
operator (such as maps, lists, anonymous function, etc), the formatter
will start the data structure in the same line as the operator:
map = %{
one: 1,
two: 2,
...
}
However, in some circumstances this behaviour may be undesired, such as:
assert some_long_expression(foo, bar) == {
:ok,
expected
}
In those cases, you can introduce a line break after the operator and
the formatter will respect that decision. For example:
assert some_long_expression(foo, bar) ==
{
:ok,
expected
}
or even better:
assert some_long_expression(foo, bar) ==
{:ok, expected}
## Code comments
The formatter also handles code comments in a way to guarantee a space
is always added between the beginning of the comment (#) and the next
character.
The formatter also extracts all trailing comments to their previous line.
For example, the code below
hello # world
will be rewritten to
# world
hello
Because code comments are handled apart from the code representation (AST),
there are some situations where code comments are seen as ambiguous by the
code formatter. For example, the comment in the anonymous function below
fn
arg1 ->
body1
# comment
arg2 ->
body2
end
and in this one
fn
arg1 ->
body1
# comment
arg2 ->
body2
end
are considered equivalent (the nesting is discarded alongside most of
user formatting). In such cases, the code formatter will always format to
the latter.
"""
def format_string!(string, opts \\ []) when is_binary(string) and is_list(opts) do
line_length = Keyword.get(opts, :line_length, 98)
algebra = Code.Formatter.to_algebra!(string, opts)
Inspect.Algebra.format(algebra, line_length)
end
@doc """
Formats a file.
See `format_string!/2` for more information on code formatting and
available options.
"""
def format_file!(file, opts \\ []) when is_binary(file) and is_list(opts) do
string = File.read!(file)
formatted = format_string!(string, [file: file, line: 1] ++ opts)
[formatted, ?\n]
end
@doc """
Evaluates the quoted contents.
**Warning**: Calling this function inside a macro is considered bad
practice as it will attempt to evaluate runtime values at compile time.
Macro arguments are typically transformed by unquoting them into the
returned quoted expressions (instead of evaluated).
See `eval_string/3` for a description of bindings and options.
## Examples
iex> contents = quote(do: var!(a) + var!(b))
iex> Code.eval_quoted(contents, [a: 1, b: 2], file: __ENV__.file, line: __ENV__.line)
{3, [a: 1, b: 2]}
For convenience, you can pass `__ENV__/0` as the `opts` argument and
all options will be automatically extracted from the current environment:
iex> contents = quote(do: var!(a) + var!(b))
iex> Code.eval_quoted(contents, [a: 1, b: 2], __ENV__)
{3, [a: 1, b: 2]}
"""
def eval_quoted(quoted, binding \\ [], opts \\ [])
def eval_quoted(quoted, binding, %Macro.Env{} = env) do
{value, binding, _env, _scope} = :elixir.eval_quoted(quoted, binding, Map.to_list(env))
{value, binding}
end
def eval_quoted(quoted, binding, opts) when is_list(opts) do
validate_eval_opts(opts)
{value, binding, _env, _scope} = :elixir.eval_quoted(quoted, binding, opts)
{value, binding}
end
defp validate_eval_opts(opts) do
if f = opts[:functions], do: validate_imports(:functions, f)
if m = opts[:macros], do: validate_imports(:macros, m)
if a = opts[:aliases], do: validate_aliases(:aliases, a)
if r = opts[:requires], do: validate_requires(:requires, r)
end
defp validate_requires(kind, requires) do
valid = is_list(requires) and Enum.all?(requires, &is_atom(&1))
unless valid do
raise ArgumentError, "expected :#{kind} option given to eval in the format: [module]"
end
end
defp validate_aliases(kind, aliases) do
valid =
is_list(aliases) and
Enum.all?(aliases, fn {k, v} ->
is_atom(k) and is_atom(v)
end)
unless valid do
raise ArgumentError,
"expected :#{kind} option given to eval in the format: [{module, module}]"
end
end
defp validate_imports(kind, imports) do
valid =
is_list(imports) and
Enum.all?(imports, fn {k, v} ->
is_atom(k) and is_list(v) and
Enum.all?(v, fn {name, arity} ->
is_atom(name) and is_integer(arity)
end)
end)
unless valid do
raise ArgumentError,
"expected :#{kind} option given to eval in the format: [{module, [{name, arity}]}]"
end
end
@doc """
Converts the given string to its quoted form.
Returns `{:ok, quoted_form}`
if it succeeds, `{:error, {line, error, token}}` otherwise.
## Options
* `:file` - the filename to be used in stacktraces
and the file reported in the `__ENV__/0` macro
* `:line` - the line reported in the `__ENV__/0` macro
* `:existing_atoms_only` - when `true`, raises an error
when non-existing atoms are found by the tokenizer
## Macro.to_string/2
The opposite of converting a string to its quoted form is
`Macro.to_string/2`, which converts a quoted form to a string/binary
representation.
"""
def string_to_quoted(string, opts \\ []) when is_list(opts) do
file = Keyword.get(opts, :file, "nofile")
line = Keyword.get(opts, :line, 1)
with {:ok, tokens} <- :elixir.string_to_tokens(to_charlist(string), line, file, opts) do
:elixir.tokens_to_quoted(tokens, file, opts)
end
end
@doc """
Converts the given string to its quoted form.
It returns the ast if it succeeds,
raises an exception otherwise. The exception is a `TokenMissingError`
in case a token is missing (usually because the expression is incomplete),
`SyntaxError` otherwise.
Check `string_to_quoted/2` for options information.
"""
def string_to_quoted!(string, opts \\ []) when is_list(opts) do
file = Keyword.get(opts, :file, "nofile")
line = Keyword.get(opts, :line, 1)
:elixir.string_to_quoted!(to_charlist(string), line, file, opts)
end
@doc """
Evals the given file.
Accepts `relative_to` as an argument to tell where the file is located.
While `load_file` loads a file and returns the loaded modules and their
byte code, `eval_file` simply evaluates the file contents and returns the
evaluation result and its bindings.
"""
def eval_file(file, relative_to \\ nil) when is_binary(file) do
file = find_file(file, relative_to)
eval_string(File.read!(file), [], file: file, line: 1)
end
@doc """
Loads the given file.
Accepts `relative_to` as an argument to tell where the file is located.
If the file was already required/loaded, loads it again.
It returns a list of tuples `{ModuleName, <<byte_code>>}`, one tuple for
each module defined in the file.
Notice that if `load_file` is invoked by different processes concurrently,
the target file will be loaded concurrently many times. Check `require_file/2`
if you don't want a file to be loaded concurrently.
## Examples
Code.load_file("eex_test.exs", "../eex/test") |> List.first
#=> {EExTest.Compiled, <<70, 79, 82, 49, ...>>}
"""
def load_file(file, relative_to \\ nil) when is_binary(file) do
file = find_file(file, relative_to)
:elixir_code_server.call({:acquire, file})
loaded = :elixir_compiler.file(file)
:elixir_code_server.cast({:loaded, file})
loaded
end
@doc """
Requires the given `file`.
Accepts `relative_to` as an argument to tell where the file is located.
The return value is the same as that of `load_file/2`. If the file was already
required/loaded, `require_file` doesn't do anything and returns `nil`.
Notice that if `require_file` is invoked by different processes concurrently,
the first process to invoke `require_file` acquires a lock and the remaining
ones will block until the file is available. I.e., if `require_file` is called
N times with a given file, it will be loaded only once. The first process to
call `require_file` will get the list of loaded modules, others will get `nil`.
Check `load_file/2` if you want a file to be loaded multiple times. See also
`unload_files/1`
## Examples
If the code is already loaded, it returns `nil`:
Code.require_file("eex_test.exs", "../eex/test") #=> nil
If the code is not loaded yet, it returns the same as `load_file/2`:
Code.require_file("eex_test.exs", "../eex/test") |> List.first
#=> {EExTest.Compiled, <<70, 79, 82, 49, ...>>}
"""
def require_file(file, relative_to \\ nil) when is_binary(file) do
file = find_file(file, relative_to)
case :elixir_code_server.call({:acquire, file}) do
:loaded ->
nil
{:queued, ref} ->
receive do
{:elixir_code_server, ^ref, :loaded} -> nil
end
:proceed ->
loaded = :elixir_compiler.file(file)
:elixir_code_server.cast({:loaded, file})
loaded
end
end
@doc """
Gets the compilation options from the code server.
Check `compiler_options/1` for more information.
## Examples
Code.compiler_options
#=> %{debug_info: true, docs: true,
#=> warnings_as_errors: false, ignore_module_conflict: false}
"""
def compiler_options do
:elixir_config.get(:compiler_options)
end
@doc """
Returns a list with the available compiler options.
See `Code.compiler_options/1` for more info.
## Examples
iex> Code.available_compiler_options
[:docs, :debug_info, :ignore_module_conflict, :relative_paths, :warnings_as_errors]
"""
def available_compiler_options do
[:docs, :debug_info, :ignore_module_conflict, :relative_paths, :warnings_as_errors]
end
@doc """
Sets compilation options.
These options are global since they are stored by Elixir's Code Server.
Available options are:
* `:docs` - when `true`, retain documentation in the compiled module,
`true` by default
* `:debug_info` - when `true`, retain debug information in the compiled
module; this allows a developer to reconstruct the original source
code, `false` by default
* `:ignore_module_conflict` - when `true`, override modules that were
already defined without raising errors, `false` by default
* `:relative_paths` - when `true`, use relative paths in quoted nodes,
warnings and errors generated by the compiler, `true` by default.
Note disabling this option won't affect runtime warnings and errors.
* `:warnings_as_errors` - causes compilation to fail when warnings are
generated
It returns the new list of compiler options.
## Examples
Code.compiler_options(debug_info: true)
#=> %{debug_info: true, docs: true,
#=> warnings_as_errors: false, ignore_module_conflict: false}
"""
def compiler_options(opts) do
available = available_compiler_options()
Enum.each(opts, fn {key, value} ->
cond do
key not in available ->
raise "unknown compiler option: #{inspect(key)}"
not is_boolean(value) ->
raise "compiler option #{inspect(key)} should be a boolean, got: #{inspect(value)}"
true ->
:ok
end
end)
:elixir_config.update(:compiler_options, &Enum.into(opts, &1))
end
@doc """
Compiles the given string.
Returns a list of tuples where the first element is the module name
and the second one is its byte code (as a binary). A `file` can be
given as second argument which will be used for reporting warnings
and errors.
For compiling many files at once, check `Kernel.ParallelCompiler.compile/2`.
"""
def compile_string(string, file \\ "nofile") when is_binary(file) do
:elixir_compiler.string(to_charlist(string), file)
end
@doc """
Compiles the quoted expression.
Returns a list of tuples where the first element is the module name and
the second one is its byte code (as a binary). A `file` can be
given as second argument which will be used for reporting warnings
and errors.
"""
def compile_quoted(quoted, file \\ "nofile") when is_binary(file) do
:elixir_compiler.quoted(quoted, file)
end
@doc """
Ensures the given module is loaded.
If the module is already loaded, this works as no-op. If the module
was not yet loaded, it tries to load it.
If it succeeds in loading the module, it returns `{:module, module}`.
If not, returns `{:error, reason}` with the error reason.
## Code loading on the Erlang VM
Erlang has two modes to load code: interactive and embedded.
By default, the Erlang VM runs in interactive mode, where modules
are loaded as needed. In embedded mode the opposite happens, as all
modules need to be loaded upfront or explicitly.
Therefore, this function is used to check if a module is loaded
before using it and allows one to react accordingly. For example, the `URI`
module uses this function to check if a specific parser exists for a given
URI scheme.
## `ensure_compiled/1`
Elixir also contains an `ensure_compiled/1` function that is a
superset of `ensure_loaded/1`.
Since Elixir's compilation happens in parallel, in some situations
you may need to use a module that was not yet compiled, therefore
it can't even be loaded.
When invoked, `ensure_compiled/1` halts the compilation of the caller
until the module given to `ensure_compiled/1` becomes available or
all files for the current project have been compiled. If compilation
finishes and the module is not available, an error tuple is returned.
`ensure_compiled/1` does not apply to dependencies, as dependencies
must be compiled upfront.
In most cases, `ensure_loaded/1` is enough. `ensure_compiled/1`
must be used in rare cases, usually involving macros that need to
invoke a module for callback information.
## Examples
iex> Code.ensure_loaded(Atom)
{:module, Atom}
iex> Code.ensure_loaded(DoesNotExist)
{:error, :nofile}
"""
@spec ensure_loaded(module) ::
{:module, module} | {:error, :embedded | :badfile | :nofile | :on_load_failure}
def ensure_loaded(module) when is_atom(module) do
:code.ensure_loaded(module)
end
@doc """
Ensures the given module is loaded.
Similar to `ensure_loaded/1`, but returns `true` if the module
is already loaded or was successfully loaded. Returns `false`
otherwise.
## Examples
iex> Code.ensure_loaded?(Atom)
true
"""
def ensure_loaded?(module) when is_atom(module) do
match?({:module, ^module}, ensure_loaded(module))
end
@doc """
Ensures the given module is compiled and loaded.
If the module is already loaded, it works as no-op. If the module was
not loaded yet, it checks if it needs to be compiled first and then
tries to load it.
If it succeeds in loading the module, it returns `{:module, module}`.
If not, returns `{:error, reason}` with the error reason.
Check `ensure_loaded/1` for more information on module loading
and when to use `ensure_loaded/1` or `ensure_compiled/1`.
"""
@spec ensure_compiled(module) ::
{:module, module} | {:error, :embedded | :badfile | :nofile | :on_load_failure}
def ensure_compiled(module) when is_atom(module) do
case :code.ensure_loaded(module) do
{:error, :nofile} = error ->
if is_pid(:erlang.get(:elixir_compiler_pid)) and
Kernel.ErrorHandler.ensure_compiled(module, :module) do
{:module, module}
else
error
end
other ->
other
end
end
@doc """
Ensures the given module is compiled and loaded.
Similar to `ensure_compiled/1`, but returns `true` if the module
is already loaded or was successfully loaded and compiled.
Returns `false` otherwise.
"""
@spec ensure_compiled?(module) :: boolean
def ensure_compiled?(module) when is_atom(module) do
match?({:module, ^module}, ensure_compiled(module))
end
@doc ~S"""
Returns the docs for the given module.
When given a module name, it finds its BEAM code and reads the docs from it.
When given a path to a .beam file, it will load the docs directly from that
file.
The return value depends on the `kind` value:
* `:docs` - list of all docstrings attached to functions and macros
using the `@doc` attribute
* `:moduledoc` - tuple `{<line>, <doc>}` where `line` is the line on
which module definition starts and `doc` is the string
attached to the module using the `@moduledoc` attribute
* `:callback_docs` - list of all docstrings attached to
`@callbacks` using the `@doc` attribute
* `:type_docs` - list of all docstrings attached to
`@type` callbacks using the `@typedoc` attribute
* `:all` - a keyword list with `:docs` and `:moduledoc`, `:callback_docs`,
and `:type_docs`.
If the module cannot be found, it returns `nil`.
## Examples
# Get the module documentation
iex> {_line, text} = Code.get_docs(Atom, :moduledoc)
iex> String.split(text, "\n") |> Enum.at(0)
"Convenience functions for working with atoms."
# Module doesn't exist
iex> Code.get_docs(ModuleNotGood, :all)
nil
"""
@doc_kinds [:docs, :moduledoc, :callback_docs, :type_docs, :all]
def get_docs(module, kind) when is_atom(module) and kind in @doc_kinds do
case :code.get_object_code(module) do
{_module, bin, _beam_path} ->
do_get_docs(bin, kind)
:error ->
nil
end
end
def get_docs(binpath, kind) when is_binary(binpath) and kind in @doc_kinds do
do_get_docs(String.to_charlist(binpath), kind)
end
@docs_chunk 'ExDc'
defp do_get_docs(bin_or_path, kind) do
case :beam_lib.chunks(bin_or_path, [@docs_chunk]) do
{:ok, {_module, [{@docs_chunk, bin}]}} ->
lookup_docs(:erlang.binary_to_term(bin), kind)
{:error, :beam_lib, {:missing_chunk, _, @docs_chunk}} ->
nil
end
end
defp lookup_docs({:elixir_docs_v1, docs}, kind), do: do_lookup_docs(docs, kind)
# unsupported chunk version
defp lookup_docs(_, _), do: nil
defp do_lookup_docs(docs, :all), do: docs
defp do_lookup_docs(docs, kind), do: Keyword.get(docs, kind)
## Helpers
# Finds the file given the relative_to path.
#
# If the file is found, returns its path in binary, fails otherwise.
defp find_file(file, relative_to) do
file =
if relative_to do
Path.expand(file, relative_to)
else
Path.expand(file)
end
if File.regular?(file) do
file
else
raise Code.LoadError, file: file
end
end
end
| 31.265152 | 97 | 0.682924 |
9e877d968db160a19cb9bc48037b3f196afd02fb | 155 | ex | Elixir | lib/hl7/2.3.1/datatypes/qip.ex | calvinb/elixir-hl7 | 5e953fa11f9184857c0ec4dda8662889f35a6bec | [
"Apache-2.0"
] | null | null | null | lib/hl7/2.3.1/datatypes/qip.ex | calvinb/elixir-hl7 | 5e953fa11f9184857c0ec4dda8662889f35a6bec | [
"Apache-2.0"
] | null | null | null | lib/hl7/2.3.1/datatypes/qip.ex | calvinb/elixir-hl7 | 5e953fa11f9184857c0ec4dda8662889f35a6bec | [
"Apache-2.0"
] | null | null | null | defmodule HL7.V2_3_1.DataTypes.Qip do
@moduledoc false
use HL7.DataType,
fields: [
field_name: nil,
value1value2value3: nil
]
end
| 15.5 | 37 | 0.664516 |
9e87e3b9f0580cf1a389bb421ec08a3374fad4b0 | 2,131 | ex | Elixir | lib/phoenix/live_dashboard/info/app_info_component.ex | feng19/phoenix_live_dashboard | a415422e2ef11527c983a29fb9f3c9e03808439c | [
"MIT"
] | 1,733 | 2020-03-03T14:39:31.000Z | 2022-03-29T14:11:23.000Z | lib/phoenix/live_dashboard/info/app_info_component.ex | feng19/phoenix_live_dashboard | a415422e2ef11527c983a29fb9f3c9e03808439c | [
"MIT"
] | 306 | 2020-03-06T08:28:01.000Z | 2022-03-23T06:38:29.000Z | deps/phoenix_live_dashboard/lib/phoenix/live_dashboard/info/app_info_component.ex | adrianomota/blog | ef3b2d2ed54f038368ead8234d76c18983caa75b | [
"MIT"
] | 169 | 2020-03-05T05:04:10.000Z | 2022-03-28T18:36:27.000Z | defmodule Phoenix.LiveDashboard.AppInfoComponent do
use Phoenix.LiveDashboard.Web, :live_component
alias Phoenix.LiveDashboard.{PageBuilder, SystemInfo, ReingoldTilford}
@impl true
def render(assigns) do
~H"""
<div class="app-info">
<%= if @alive do %>
<svg width={@width} height={@height} id="tree" class="tree" >
<%= for node <- @nodes do %>
<rect x={node.x} y={node.y} rx="10" ry="10" width={node.width} height={node.height}
class="node" phx-click="show_info" phx-value-info={node_encoded_pid(node.value)} phx-page-loading />
<text class="tree-node-text" x={node.x + 10} y={node.y + div(node.height, 2)} dominant-baseline="central">
<%= node.label %>
</text>
<% end %>
<%= for line <- @lines do %>
<line x1={line.x1} y1={line.y1} x2={line.x2} y2={line.y2} class="line" />
<% end %>
</svg>
<% else %>
<div class="app-info-exits mt-1 mb-3">No app or no supervision tree for app exists.</div>
<% end %>
</div>
"""
end
@impl true
def mount(socket) do
{:ok, socket}
end
@impl true
def update(%{id: "App<" <> app, path: path, node: node}, socket) do
app = app |> String.replace_suffix(">", "") |> String.to_existing_atom()
{:ok, socket |> assign(app: app, path: path, node: node) |> assign_tree()}
end
defp assign_tree(%{assigns: assigns} = socket) do
case SystemInfo.fetch_app_tree(assigns.node, assigns.app) do
{_, _} = tree ->
tree = ReingoldTilford.build(tree, &node_label/1)
nodes = ReingoldTilford.nodes(tree)
lines = ReingoldTilford.lines(tree)
{width, height} = ReingoldTilford.dimensions(nodes)
assign(socket, nodes: nodes, lines: lines, width: width, height: height, alive: true)
:error ->
assign(socket, alive: false)
end
end
defp node_encoded_pid({_, pid, _}), do: PageBuilder.encode_pid(pid)
defp node_label({_, pid, []}), do: pid |> :erlang.pid_to_list() |> List.to_string()
defp node_label({_, _, name}), do: inspect(name)
end
| 35.516667 | 118 | 0.593618 |
9e88050aa5b8fac402bdace4783ddc7553716c70 | 3,333 | exs | Elixir | mix.exs | almirsarajcic/phoenix_live_view | 6cecf857494d4ec43d89be5d6cc4d4d4ff53780d | [
"MIT"
] | null | null | null | mix.exs | almirsarajcic/phoenix_live_view | 6cecf857494d4ec43d89be5d6cc4d4d4ff53780d | [
"MIT"
] | null | null | null | mix.exs | almirsarajcic/phoenix_live_view | 6cecf857494d4ec43d89be5d6cc4d4d4ff53780d | [
"MIT"
] | null | null | null | defmodule Phoenix.LiveView.MixProject do
use Mix.Project
@version "0.16.0-dev"
def project do
[
app: :phoenix_live_view,
version: @version,
elixir: "~> 1.7",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
compilers: compilers(Mix.env()),
package: package(),
xref: [exclude: [Floki]],
deps: deps(),
docs: docs(),
name: "Phoenix LiveView",
homepage_url: "http://www.phoenixframework.org",
description: """
Rich, real-time user experiences with server-rendered HTML
"""
]
end
defp compilers(:test), do: [:phoenix] ++ Mix.compilers()
defp compilers(_), do: Mix.compilers()
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
def application do
[
extra_applications: [:logger],
mod: {Phoenix.LiveView.Application, []}
]
end
defp deps do
[
{:phoenix, github: "phoenixframework/phoenix", branch: "v1.5"},
{:phoenix_html, github: "phoenixframework/phoenix_html", override: true},
{:telemetry, "~> 0.4.2 or ~> 0.5"},
{:jason, "~> 1.0", optional: true},
{:ex_doc, "~> 0.22", only: :docs},
{:floki, "~> 0.30.0", only: :test},
{:html_entities, ">= 0.0.0", only: :test}
]
end
defp docs do
[
main: "Phoenix.LiveView",
source_ref: "v#{@version}",
source_url: "https://github.com/phoenixframework/phoenix_live_view",
extra_section: "GUIDES",
extras: extras(),
groups_for_extras: groups_for_extras(),
groups_for_modules: groups_for_modules()
]
end
defp extras do
[
"guides/introduction/installation.md",
"guides/client/bindings.md",
"guides/client/form-bindings.md",
"guides/client/dom-patching.md",
"guides/client/js-interop.md",
"guides/client/uploads-external.md",
"guides/server/assigns-eex.md",
"guides/server/error-handling.md",
"guides/server/live-layouts.md",
"guides/server/live-navigation.md",
"guides/server/security-model.md",
"guides/server/telemetry.md",
"guides/server/uploads.md",
"guides/server/using-gettext.md"
]
end
defp groups_for_extras do
[
Introduction: ~r/guides\/introduction\/.?/,
"Server-side features": ~r/guides\/server\/.?/,
"Client-side integration": ~r/guides\/client\/.?/
]
end
defp groups_for_modules do
[
"Upload structures": [
Phoenix.LiveView.UploadConfig,
Phoenix.LiveView.UploadEntry
],
"Testing structures": [
Phoenix.LiveViewTest.Element,
Phoenix.LiveViewTest.Upload,
Phoenix.LiveViewTest.View
],
"Live EEx Engine": [
Phoenix.LiveView.Engine,
Phoenix.LiveView.HTMLEngine,
Phoenix.LiveView.Component,
Phoenix.LiveView.Rendered,
Phoenix.LiveView.Comprehension
]
]
end
defp package do
[
maintainers: ["Chris McCord", "José Valim", "Gary Rennie", "Alex Garibay", "Scott Newcomer"],
licenses: ["MIT"],
links: %{github: "https://github.com/phoenixframework/phoenix_live_view"},
files:
~w(assets/js lib priv) ++
~w(CHANGELOG.md LICENSE.md mix.exs package.json README.md)
]
end
end
| 27.319672 | 99 | 0.60456 |
9e88425b0aadee295aef4fac44879a82ad04978d | 1,629 | exs | Elixir | test/fixes/readability/alias_order_test.exs | doorgan/credo_fixes | e64869bbd53644bb11480f925540cf75c73432af | [
"Apache-2.0"
] | null | null | null | test/fixes/readability/alias_order_test.exs | doorgan/credo_fixes | e64869bbd53644bb11480f925540cf75c73432af | [
"Apache-2.0"
] | null | null | null | test/fixes/readability/alias_order_test.exs | doorgan/credo_fixes | e64869bbd53644bb11480f925540cf75c73432af | [
"Apache-2.0"
] | null | null | null | defmodule CredoFixesTest.Fixes.Readability.AliasOrder do
use ExUnit.Case, async: true
import CredoFixes.Test
cases = [
%{
name: "orders aliases",
original: ~S"""
defmodule Test do
alias J
alias C
# Comment for B
alias B
alias A
alias H
end
""",
expected: ~S"""
defmodule Test do
alias A
# Comment for B
alias B
alias C
alias H
alias J
end
"""
},
%{
name: "with other stuff in between",
original: ~S"""
defmodule Test do
alias J
alias C
@foo bar
alias B
alias A
alias H
end
""",
expected: ~S"""
defmodule Test do
alias C
alias J
@foo bar
alias A
alias B
alias H
end
"""
},
%{
name: "with multi aliases",
original: ~S"""
defmodule Test do
alias C
alias J.{F, B}
alias J.{A}
alias A
alias B
alias H
end
""",
expected: ~S"""
defmodule Test do
alias A
alias B
alias C
alias H
alias J.{A}
alias J.{F, B}
end
"""
},
%{
name: "doesn't change already ordered aliases",
original: ~S"""
defmodule Test do
alias A; alias B; alias C
end
""",
expected: ~S"""
defmodule Test do
alias A; alias B; alias C
end
"""
}
]
test_fixes(CredoFixes.Fixes.Readability.AliasOrder, cases)
end
| 17.516129 | 60 | 0.452425 |
9e884424dc07f92339b08532c095151960302e05 | 1,746 | exs | Elixir | discuss/mix.exs | nihonjinrxs/udemy-elixir-phoenix | 0646f7fa3c854bb010087811e7c368d8021721a4 | [
"MIT"
] | null | null | null | discuss/mix.exs | nihonjinrxs/udemy-elixir-phoenix | 0646f7fa3c854bb010087811e7c368d8021721a4 | [
"MIT"
] | null | null | null | discuss/mix.exs | nihonjinrxs/udemy-elixir-phoenix | 0646f7fa3c854bb010087811e7c368d8021721a4 | [
"MIT"
] | null | null | null | defmodule Discuss.Mixfile do
use Mix.Project
def project do
[app: :discuss,
version: "0.0.1",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
aliases: aliases(),
deps: deps()]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[mod: {Discuss, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex, :ueberauth, :ueberauth_github]]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "web", "test/support"]
defp elixirc_paths(_), do: ["lib", "web"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[{:phoenix, "~> 1.2.1"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.0"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.6"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:cowboy, "~> 1.0"},
{:ueberauth, "~> 0.3"},
{:ueberauth_github, "~> 0.4"}
]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, to create, migrate and run the seeds file at once:
#
# $ mix ecto.setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
["ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
"test": ["ecto.create --quiet", "ecto.migrate", "test"]]
end
end
| 30.103448 | 89 | 0.598511 |
9e886ecd5936b212803c841c5dfd42ba5f48119a | 3,587 | exs | Elixir | apps/reaper/mix.exs | smartcitiesdata/smartcitiesdata | c926c25003a8ee2d09b933c521c49f674841c0b6 | [
"Apache-2.0"
] | 26 | 2019-09-20T23:54:45.000Z | 2020-08-20T14:23:32.000Z | apps/reaper/mix.exs | smartcitiesdata/smartcitiesdata | c926c25003a8ee2d09b933c521c49f674841c0b6 | [
"Apache-2.0"
] | 757 | 2019-08-15T18:15:07.000Z | 2020-09-18T20:55:31.000Z | apps/reaper/mix.exs | smartcitiesdata/smartcitiesdata | c926c25003a8ee2d09b933c521c49f674841c0b6 | [
"Apache-2.0"
] | 9 | 2019-11-12T16:43:46.000Z | 2020-03-25T16:23:16.000Z | defmodule Reaper.MixProject do
use Mix.Project
def project do
[
app: :reaper,
version: "2.0.5",
elixir: "~> 1.10",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
start_permanent: Mix.env() == :prod,
deps: deps(),
aliases: aliases(),
elixirc_paths: elixirc_paths(Mix.env()),
test_paths: test_paths(Mix.env()),
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
format: :test,
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test
]
]
end
def application do
[
extra_applications: [:logger, :eex],
mod: {Reaper.Application, []}
]
end
defp aliases() do
[
test: "test --no-start"
]
end
defp deps do
[
{:atomic_map, "~> 0.9"},
{:brook, "~> 0.4.0"},
{:cachex, "~> 3.2"},
{:castore, "~> 0.1"},
{:cowlib, "~> 2.8", override: true},
{:ranch, "~> 1.7.1", override: true},
{:dead_letter, in_umbrella: true},
{:providers, in_umbrella: true},
{:distillery, "~> 2.1"},
{:ex_aws, "~> 2.1"},
{:ex_aws_s3, "~> 2.0",
[env: :prod, git: "https://github.com/ex-aws/ex_aws_s3", ref: "6b9fdac73b62dee14bffb939965742f2576f2a7b"]},
{:gen_stage, "~> 1.0", override: true},
{:hackney, "~> 1.17"},
{:horde, "~> 0.7.0"},
{:httpoison, "~> 1.6"},
{:poison, "~> 3.1", override: true},
{:jason, "~> 1.1", override: true},
{:jaxon, "~> 1.0"},
{:libcluster, "~> 3.1"},
{:libvault, "~> 0.2.3"},
{:mint, "~> 1.2"},
{:nimble_csv, "~> 0.6.0"},
{:observer_cli, "~> 1.5"},
{:properties, in_umbrella: true},
{:plug_cowboy, "~> 2.1"},
{:protobuf, "~> 0.6"},
{:quantum, "~> 2.4"},
{:redix, "~> 0.10"},
{:retry, "~> 0.13"},
{:sftp_ex, "~> 0.2"},
{:smart_city, "~> 5.2.1"},
{:saxy, "~> 0.10"},
{:sweet_xml, "~> 0.6"},
{:telemetry_event, in_umbrella: true},
{:tesla, "~> 1.3"},
{:timex, "~> 3.6"},
# Test/Dev Dependencies
{:tasks, in_umbrella: true, only: :dev},
{:bypass, "~> 2.0", only: [:test, :integration]},
{:checkov, "~> 1.0", only: [:test, :integration]},
{:credo, "~> 1.0", only: [:dev, :test, :integration], runtime: false},
{:dialyxir, "~> 1.0.0-rc.6", only: :dev, runtime: false},
{:divo, "~> 1.3", only: [:dev, :integration], override: true},
{:divo_kafka, "~> 0.1", only: [:dev, :integration]},
{:divo_redis, "~> 0.1", only: [:dev, :integration]},
{:excoveralls, "~> 0.11", only: :test},
{:mix_test_watch, "~> 1.0", only: :dev, runtime: false},
{:mock, "~> 0.3", only: [:test, :integration], runtime: false},
{:mox, "~> 1.0", only: [:dev, :test, :integration]},
{:patiently, "~> 0.2", only: [:dev, :test, :integration], override: true},
{:phoenix, "~> 1.4", only: :test},
{:placebo, "~> 2.0.0-rc2", only: [:dev, :test, :integration]},
{:smart_city_test, "~> 2.2.1", only: [:test, :integration]},
{:temp, "~> 0.4", only: [:test, :integration]},
{:performance, in_umbrella: true, only: :integration},
{:unzip, "~> 0.6.0"}
]
end
defp elixirc_paths(env) when env in [:test, :integration], do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp test_paths(:integration), do: ["test/integration"]
defp test_paths(_), do: ["test/unit"]
end
| 32.609091 | 114 | 0.499582 |
9e8871c976d4cf2d4c2b1134f0d2af89cdb7ae54 | 2,211 | ex | Elixir | clients/remote_build_execution/lib/google_api/remote_build_execution/v2/model/build_bazel_remote_execution_v2_log_file.ex | MasashiYokota/elixir-google-api | 975dccbff395c16afcb62e7a8e411fbb58e9ab01 | [
"Apache-2.0"
] | null | null | null | clients/remote_build_execution/lib/google_api/remote_build_execution/v2/model/build_bazel_remote_execution_v2_log_file.ex | MasashiYokota/elixir-google-api | 975dccbff395c16afcb62e7a8e411fbb58e9ab01 | [
"Apache-2.0"
] | 1 | 2020-12-18T09:25:12.000Z | 2020-12-18T09:25:12.000Z | clients/remote_build_execution/lib/google_api/remote_build_execution/v2/model/build_bazel_remote_execution_v2_log_file.ex | MasashiYokota/elixir-google-api | 975dccbff395c16afcb62e7a8e411fbb58e9ab01 | [
"Apache-2.0"
] | 1 | 2020-10-04T10:12:44.000Z | 2020-10-04T10:12:44.000Z | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2LogFile do
@moduledoc """
A `LogFile` is a log stored in the CAS.
## Attributes
* `digest` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Digest.t`, *default:* `nil`) - The digest of the log contents.
* `humanReadable` (*type:* `boolean()`, *default:* `nil`) - This is a hint as to the purpose of the log, and is set to true if the log is human-readable text that can be usefully displayed to a user, and false otherwise. For instance, if a command-line client wishes to print the server logs to the terminal for a failed action, this allows it to avoid displaying a binary file.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:digest =>
GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Digest.t(),
:humanReadable => boolean()
}
field(:digest, as: GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Digest)
field(:humanReadable)
end
defimpl Poison.Decoder,
for: GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2LogFile do
def decode(value, options) do
GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2LogFile.decode(
value,
options
)
end
end
defimpl Poison.Encoder,
for: GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2LogFile do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 39.482143 | 382 | 0.751244 |
9e887482f90e756a10695804a9780746c78f5089 | 908 | ex | Elixir | clients/assured_workloads/lib/google_api/assured_workloads/v1beta1/metadata.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | null | null | null | clients/assured_workloads/lib/google_api/assured_workloads/v1beta1/metadata.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | null | null | null | clients/assured_workloads/lib/google_api/assured_workloads/v1beta1/metadata.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.AssuredWorkloads.V1beta1 do
@moduledoc """
API client metadata for GoogleApi.AssuredWorkloads.V1beta1.
"""
@discovery_revision "20211111"
def discovery_revision(), do: @discovery_revision
end
| 33.62963 | 74 | 0.765419 |
9e8876f9334653925492efb1f3ac6d7ee4a37dc7 | 12,958 | ex | Elixir | clients/monitoring/lib/google_api/monitoring/v3/api/folders.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2021-12-20T03:40:53.000Z | 2021-12-20T03:40:53.000Z | clients/monitoring/lib/google_api/monitoring/v3/api/folders.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2020-08-18T00:11:23.000Z | 2020-08-18T00:44:16.000Z | clients/monitoring/lib/google_api/monitoring/v3/api/folders.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.Monitoring.V3.Api.Folders do
@moduledoc """
API calls for all endpoints tagged `Folders`.
"""
alias GoogleApi.Monitoring.V3.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Lists time series that match a filter. This method does not require a Workspace.
## Parameters
* `connection` (*type:* `GoogleApi.Monitoring.V3.Connection.t`) - Connection to server
* `folders_id` (*type:* `String.t`) - Part of `name`. Required. The project (https://cloud.google.com/monitoring/api/v3#project_name), organization or folder on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER] organizations/[ORGANIZATION_ID] folders/[FOLDER_ID]
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:"aggregation.alignmentPeriod"` (*type:* `String.t`) - The alignment_period specifies a time interval, in seconds, that is used to divide the data in all the time series into consistent blocks of time. This will be done before the per-series aligner can be applied to the data.The value must be at least 60 seconds. If a per-series aligner other than ALIGN_NONE is specified, this field is required or an error is returned. If no per-series aligner is specified, or the aligner ALIGN_NONE is specified, then this field is ignored.The maximum value of the alignment_period is 104 weeks (2 years) for charts, and 90,000 seconds (25 hours) for alerting policies.
* `:"aggregation.crossSeriesReducer"` (*type:* `String.t`) - The reduction operation to be used to combine time series into a single time series, where the value of each data point in the resulting series is a function of all the already aligned values in the input time series.Not all reducer operations can be applied to all time series. The valid choices depend on the metric_kind and the value_type of the original time series. Reduction can yield a time series with a different metric_kind or value_type than the input time series.Time series data must first be aligned (see per_series_aligner) in order to perform cross-time series reduction. If cross_series_reducer is specified, then per_series_aligner must be specified, and must not be ALIGN_NONE. An alignment_period must also be specified; otherwise, an error is returned.
* `:"aggregation.groupByFields"` (*type:* `list(String.t)`) - The set of fields to preserve when cross_series_reducer is specified. The group_by_fields determine how the time series are partitioned into subsets prior to applying the aggregation operation. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The cross_series_reducer is applied to each subset of time series. It is not possible to reduce across different resource types, so this field implicitly contains resource.type. Fields not specified in group_by_fields are aggregated away. If group_by_fields is not specified and all the time series have the same resource type, then the time series are aggregated into a single output time series. If cross_series_reducer is not defined, this field is ignored.
* `:"aggregation.perSeriesAligner"` (*type:* `String.t`) - An Aligner describes how to bring the data points in a single time series into temporal alignment. Except for ALIGN_NONE, all alignments cause all the data points in an alignment_period to be mathematically grouped together, resulting in a single data point for each alignment_period with end timestamp at the end of the period.Not all alignment operations may be applied to all time series. The valid choices depend on the metric_kind and value_type of the original time series. Alignment can change the metric_kind or the value_type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If cross_series_reducer is specified, then per_series_aligner must be specified and not equal to ALIGN_NONE and alignment_period must be specified; otherwise, an error is returned.
* `:filter` (*type:* `String.t`) - Required. A monitoring filter (https://cloud.google.com/monitoring/api/v3/filters) that specifies which time series should be returned. The filter must specify a single metric type, and can additionally specify metric labels and other information. For example: metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND metric.labels.instance_name = "my-instance-name"
* `:"interval.endTime"` (*type:* `DateTime.t`) - Required. The end of the time interval.
* `:"interval.startTime"` (*type:* `DateTime.t`) - Optional. The beginning of the time interval. The default value for the start time is the end time. The start time must not be later than the end time.
* `:orderBy` (*type:* `String.t`) - Unsupported: must be left blank. The points in each time series are currently returned in reverse time order (most recent to oldest).
* `:pageSize` (*type:* `integer()`) - A positive number that is the maximum number of results to return. If page_size is empty or more than 100,000 results, the effective page_size is 100,000 results. If view is set to FULL, this is the maximum number of Points returned. If view is set to HEADERS, this is the maximum number of TimeSeries returned.
* `:pageToken` (*type:* `String.t`) - If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.
* `:"secondaryAggregation.alignmentPeriod"` (*type:* `String.t`) - The alignment_period specifies a time interval, in seconds, that is used to divide the data in all the time series into consistent blocks of time. This will be done before the per-series aligner can be applied to the data.The value must be at least 60 seconds. If a per-series aligner other than ALIGN_NONE is specified, this field is required or an error is returned. If no per-series aligner is specified, or the aligner ALIGN_NONE is specified, then this field is ignored.The maximum value of the alignment_period is 104 weeks (2 years) for charts, and 90,000 seconds (25 hours) for alerting policies.
* `:"secondaryAggregation.crossSeriesReducer"` (*type:* `String.t`) - The reduction operation to be used to combine time series into a single time series, where the value of each data point in the resulting series is a function of all the already aligned values in the input time series.Not all reducer operations can be applied to all time series. The valid choices depend on the metric_kind and the value_type of the original time series. Reduction can yield a time series with a different metric_kind or value_type than the input time series.Time series data must first be aligned (see per_series_aligner) in order to perform cross-time series reduction. If cross_series_reducer is specified, then per_series_aligner must be specified, and must not be ALIGN_NONE. An alignment_period must also be specified; otherwise, an error is returned.
* `:"secondaryAggregation.groupByFields"` (*type:* `list(String.t)`) - The set of fields to preserve when cross_series_reducer is specified. The group_by_fields determine how the time series are partitioned into subsets prior to applying the aggregation operation. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The cross_series_reducer is applied to each subset of time series. It is not possible to reduce across different resource types, so this field implicitly contains resource.type. Fields not specified in group_by_fields are aggregated away. If group_by_fields is not specified and all the time series have the same resource type, then the time series are aggregated into a single output time series. If cross_series_reducer is not defined, this field is ignored.
* `:"secondaryAggregation.perSeriesAligner"` (*type:* `String.t`) - An Aligner describes how to bring the data points in a single time series into temporal alignment. Except for ALIGN_NONE, all alignments cause all the data points in an alignment_period to be mathematically grouped together, resulting in a single data point for each alignment_period with end timestamp at the end of the period.Not all alignment operations may be applied to all time series. The valid choices depend on the metric_kind and value_type of the original time series. Alignment can change the metric_kind or the value_type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If cross_series_reducer is specified, then per_series_aligner must be specified and not equal to ALIGN_NONE and alignment_period must be specified; otherwise, an error is returned.
* `:view` (*type:* `String.t`) - Required. Specifies which information is returned about the time series.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Monitoring.V3.Model.ListTimeSeriesResponse{}}` on success
* `{:error, info}` on failure
"""
@spec monitoring_folders_time_series_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Monitoring.V3.Model.ListTimeSeriesResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def monitoring_folders_time_series_list(
connection,
folders_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:"aggregation.alignmentPeriod" => :query,
:"aggregation.crossSeriesReducer" => :query,
:"aggregation.groupByFields" => :query,
:"aggregation.perSeriesAligner" => :query,
:filter => :query,
:"interval.endTime" => :query,
:"interval.startTime" => :query,
:orderBy => :query,
:pageSize => :query,
:pageToken => :query,
:"secondaryAggregation.alignmentPeriod" => :query,
:"secondaryAggregation.crossSeriesReducer" => :query,
:"secondaryAggregation.groupByFields" => :query,
:"secondaryAggregation.perSeriesAligner" => :query,
:view => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v3/folders/{foldersId}/timeSeries", %{
"foldersId" => URI.encode(folders_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Monitoring.V3.Model.ListTimeSeriesResponse{}])
end
end
| 105.349593 | 892 | 0.737768 |
9e887dde6058df7df1f107171177223b17556d97 | 928 | ex | Elixir | apps/snitch_core/priv/repo/seed/payment_methods.ex | VeryBigThings/avia | 7ce5d5b244ae0dfddc30c09c17efe27f1718a4c9 | [
"MIT"
] | 1 | 2021-04-08T22:29:19.000Z | 2021-04-08T22:29:19.000Z | apps/snitch_core/priv/repo/seed/payment_methods.ex | VeryBigThings/avia | 7ce5d5b244ae0dfddc30c09c17efe27f1718a4c9 | [
"MIT"
] | null | null | null | apps/snitch_core/priv/repo/seed/payment_methods.ex | VeryBigThings/avia | 7ce5d5b244ae0dfddc30c09c17efe27f1718a4c9 | [
"MIT"
] | null | null | null | defmodule Snitch.Seed.PaymentMethods do
@moduledoc """
Seeds supported PaymentMethods.
Snitch comes with some payment methods built-in:
1. credit or debit cards
## Cards
This payment method is backed by the `Snitch.Data.Schema.CardPayments`
schema and table.
## Roadmap
Snitch will support "Store Credits", which act like e-wallets for users.
"""
alias Snitch.Data.Schema.PaymentMethod
alias Snitch.Core.Tools.MultiTenancy.Repo
def seed!() do
methods = [
%{
name: "check",
code: "chk",
active?: true,
inserted_at: DateTime.utc_now(),
updated_at: DateTime.utc_now()
},
%{
name: "card",
code: "ccd",
active?: true,
inserted_at: DateTime.utc_now(),
updated_at: DateTime.utc_now()
}
]
Repo.insert_all(PaymentMethod, methods, on_conflict: :nothing, conflict_target: :code)
end
end
| 22.095238 | 90 | 0.633621 |
9e8893a606331edd651a013893e0e577057f607e | 1,507 | ex | Elixir | clients/gmail/lib/google_api/gmail/v1/model/list_filters_response.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2021-12-20T03:40:53.000Z | 2021-12-20T03:40:53.000Z | clients/gmail/lib/google_api/gmail/v1/model/list_filters_response.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2020-08-18T00:11:23.000Z | 2020-08-18T00:44:16.000Z | clients/gmail/lib/google_api/gmail/v1/model/list_filters_response.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.Gmail.V1.Model.ListFiltersResponse do
@moduledoc """
Response for the ListFilters method.
## Attributes
* `filter` (*type:* `list(GoogleApi.Gmail.V1.Model.Filter.t)`, *default:* `nil`) - List of a user's filters.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:filter => list(GoogleApi.Gmail.V1.Model.Filter.t()) | nil
}
field(:filter, as: GoogleApi.Gmail.V1.Model.Filter, type: :list)
end
defimpl Poison.Decoder, for: GoogleApi.Gmail.V1.Model.ListFiltersResponse do
def decode(value, options) do
GoogleApi.Gmail.V1.Model.ListFiltersResponse.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.Gmail.V1.Model.ListFiltersResponse do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 32.06383 | 112 | 0.735899 |
9e88954654db8d08a86c96a45f8a42229a47f064 | 1,587 | exs | Elixir | config/dev.exs | avval-alumni/alumni_book | 17b27da849919312a332aaa3b39ce5c65032f2b4 | [
"MIT"
] | null | null | null | config/dev.exs | avval-alumni/alumni_book | 17b27da849919312a332aaa3b39ce5c65032f2b4 | [
"MIT"
] | null | null | null | config/dev.exs | avval-alumni/alumni_book | 17b27da849919312a332aaa3b39ce5c65032f2b4 | [
"MIT"
] | null | null | null | use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :alumni_book, AlumniBookWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
cache_static_lookup: false,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--watch",
"--watch-poll",
"--mode=development",
"--stdin",
cd: Path.expand("../assets", __DIR__)
]
]
# Watch static and templates for browser reloading.
config :alumni_book, AlumniBookWeb.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{lib/alumni_book_web/views/.*(ex)$},
~r{lib/alumni_book_web/templates/.*(eex)$}
]
]
# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
config :alumni_book, AlumniBookWeb.Endpoint,
secret_key_base: "VQyOE7QLAMr0qyhIR+4/NtEK9G8DU+mdESssX4ZO0j05mchaW1VzebD2dZ+r9xCS"
# Set a higher stacktrace during development.
# Do not configure such in production as keeping
# and calculating stacktraces is usually expensive.
config :phoenix, :stacktrace_depth, 20
# Configure your database
config :alumni_book, AlumniBook.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "alumni_book_dev",
hostname: "localhost",
pool_size: 10
| 28.854545 | 85 | 0.712035 |
9e88aec4ef44fc70279ad151a4cd98983bd88676 | 438 | exs | Elixir | test/web_driver_client/json_wire_protocol_client/response/status_test.exs | fimassuda/web_driver_client | 09d373c9a8a923c5e2860f107f84b16565e338f7 | [
"MIT"
] | 8 | 2019-11-24T18:33:12.000Z | 2020-12-09T10:20:09.000Z | test/web_driver_client/json_wire_protocol_client/response/status_test.exs | fimassuda/web_driver_client | 09d373c9a8a923c5e2860f107f84b16565e338f7 | [
"MIT"
] | 67 | 2019-12-20T16:33:30.000Z | 2021-09-14T03:50:10.000Z | test/web_driver_client/json_wire_protocol_client/response/status_test.exs | fimassuda/web_driver_client | 09d373c9a8a923c5e2860f107f84b16565e338f7 | [
"MIT"
] | 10 | 2020-06-19T16:15:03.000Z | 2021-09-13T17:56:25.000Z | defmodule WebDriverClient.JSONWireProtocolClient.Response.StatusTest do
use ExUnit.Case, async: true
alias WebDriverClient.JSONWireProtocolClient.Response.Status
test "reason_atom/1 returns the appropriate atom from a code" do
assert :success = Status.reason_atom(0)
end
test "reason_atom/1 raises an argument error on unknown code" do
assert_raise ArgumentError, fn ->
Status.reason_atom(-1)
end
end
end
| 27.375 | 71 | 0.767123 |
9e88afcae420fc27aef83a0a1d86074d589348fb | 552 | ex | Elixir | lib/rig_inbound_gateway/api_proxy/auth.ex | steveoliver/reactive-interaction-gateway | 59b6dc994fd0f098bed19b7bf1e699513ac87167 | [
"Apache-2.0"
] | 518 | 2017-11-09T13:10:49.000Z | 2022-03-28T14:29:50.000Z | lib/rig_inbound_gateway/api_proxy/auth.ex | steveoliver/reactive-interaction-gateway | 59b6dc994fd0f098bed19b7bf1e699513ac87167 | [
"Apache-2.0"
] | 270 | 2017-11-10T00:11:34.000Z | 2022-02-27T13:08:16.000Z | lib/rig_inbound_gateway/api_proxy/auth.ex | steveoliver/reactive-interaction-gateway | 59b6dc994fd0f098bed19b7bf1e699513ac87167 | [
"Apache-2.0"
] | 67 | 2017-12-19T20:16:37.000Z | 2022-03-31T10:43:04.000Z | defmodule RigInboundGateway.ApiProxy.Auth do
@moduledoc """
Authentication check for proxied requests.
"""
alias RigInboundGateway.ApiProxy.Api
alias RigInboundGateway.ApiProxy.Auth.Jwt
# ---
@spec check(Plug.Conn.t(), Api.t(), Api.endpoint()) :: :ok | {:error, :authentication_failed}
def check(conn, api, endpoint)
# Authenticate by JWT:
def check(
conn,
%{"auth_type" => "jwt"} = api,
%{"secured" => true}
),
do: Jwt.check(conn, api)
# Skip by default
def check(_, _, _), do: :ok
end
| 22.08 | 95 | 0.621377 |
9e88b3520a0703ec26228e27f00bd4afcc22008b | 1,222 | exs | Elixir | config/config.exs | bmquinn/cardex | 012f541808dfa1b59418554ba087032f65ca8b71 | [
"Apache-2.0"
] | null | null | null | config/config.exs | bmquinn/cardex | 012f541808dfa1b59418554ba087032f65ca8b71 | [
"Apache-2.0"
] | null | null | null | config/config.exs | bmquinn/cardex | 012f541808dfa1b59418554ba087032f65ca8b71 | [
"Apache-2.0"
] | null | null | null | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
use Mix.Config
# Configures the endpoint
config :cardex, CardexWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "eOUon/73UZ1tthEc5NnWlWkkPUt94BGHOOaApmdqVg/QDUaD23t1bdhIQKQBBRoa",
render_errors: [view: CardexWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Cardex.PubSub,
live_view: [signing_salt: "v52rDwow"]
# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
config :esbuild,
version: "0.12.18",
default: [
args: ~w(js/app.js --bundle --target=es2016 --outdir=../priv/static/assets),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"
| 33.027027 | 86 | 0.735679 |
9e88df96237425f2b0793ff99be3b2581e68731e | 3,978 | ex | Elixir | lib/true_type/table/cmap.ex | john-vinters/exttf | dea21d52ef55b66f4236dc1cf3115fc7791178da | [
"Apache-2.0"
] | null | null | null | lib/true_type/table/cmap.ex | john-vinters/exttf | dea21d52ef55b66f4236dc1cf3115fc7791178da | [
"Apache-2.0"
] | null | null | null | lib/true_type/table/cmap.ex | john-vinters/exttf | dea21d52ef55b66f4236dc1cf3115fc7791178da | [
"Apache-2.0"
] | null | null | null | #
# (c) Copyright 2021 John Vinters <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
defmodule TrueType.Table.Cmap do
@moduledoc """
"cmap" table processing code.
"""
alias TrueType
alias TrueType.Table.Cmap
alias TrueType.Table.Cmap.{Format4, Format6}
@type encoding_map :: %{
optional({atom(), atom()}) => %{
offset: non_neg_integer(),
platform: TrueType.uint16(),
encoding: TrueType.uint16()
}
}
@type glyph_map :: %{optional(TrueType.glyph()) => [binary()]}
@type unicode_map :: %{optional(binary()) => TrueType.glyph()}
@type t :: %__MODULE__{
version: TrueType.uint16(),
encoding: {atom(), atom()},
raw_encoding: {TrueType.uint16(), TrueType.uint16()},
to_glyph: unicode_map(),
to_unicode: glyph_map()
}
defstruct version: 0,
encoding: {:unknown, :unknown},
raw_encoding: {0, 0},
to_glyph: %{},
to_unicode: %{}
# returns the preferred encoding and offset.
@spec get_preferred_encoding(encoding_map()) ::
{:ok, Cmap.t(), TrueType.uint32()} | TrueType.error()
defp get_preferred_encoding(tables) do
pref = [
{:windows, :unicode_bmp},
{:unicode, :unicode_2_0_bmp},
{:windows, :unicode_full},
{:unicode, :unicode_2_0_full},
{:unicode, :unicode_1_1},
{:unicode, :unicode_1_0}
]
Enum.reduce_while(pref, {:error, :unsupported_font}, fn item, acc ->
case Map.get(tables, item) do
nil ->
{:cont, acc}
v ->
{:halt, {:ok, %Cmap{encoding: item, raw_encoding: {v.platform, v.encoding}}, v.offset}}
end
end)
end
@doc """
Parses "cmap" table.
"""
@spec parse(TrueType.t(), binary()) :: {:ok, Cmap.t()} | TrueType.error()
def parse(%TrueType{}, <<0::16, num_tables::16, data::binary>>) do
with {:ok, tables} <- parse_tables(%{}, num_tables, data),
{:ok, %Cmap{} = cmap, offset} <- get_preferred_encoding(tables),
data when is_binary(data) <-
:binary.part(data, offset - 4, byte_size(data) - offset + 4),
{:ok, {to_glyph, to_unicode}, version} <- parse_subtable(data) do
{:ok, %Cmap{cmap | to_glyph: to_glyph, to_unicode: to_unicode, version: version}}
end
end
# parses subtable.
@spec parse_subtable(binary()) ::
{:ok, {unicode_map(), glyph_map()}, TrueType.uint16()} | TrueType.error()
defp parse_subtable(<<4::16, _rest::binary>> = st), do: Format4.parse_subtable(st)
defp parse_subtable(<<6::16, _rest::binary>> = st), do: Format6.parse_subtable(st)
defp parse_subtable(_), do: {:error, :unsupported_font}
# extracts table encodings ready for selection of a suitable target.
@spec parse_tables(encoding_map(), TrueType.uint16(), binary()) :: {:ok, encoding_map()}
defp(parse_tables(result, 0, _remain), do: {:ok, result})
defp parse_tables(
result,
num_tables,
<<platform::16, encoding::16, offset::32, remain::binary>>
)
when num_tables > 0 do
with {:ok, p} <- TrueType.decode_platform(platform),
{:ok, e} <- TrueType.decode_encoding(p, encoding) do
parse_tables(
Map.put(result, {p, e}, %{offset: offset, platform: platform, encoding: encoding}),
num_tables - 1,
remain
)
else
_ -> parse_tables(result, num_tables - 1, remain)
end
end
end
| 34 | 97 | 0.616642 |
9e88ec8de7016d6a915bf6781807ebbb2cdf993d | 586 | ex | Elixir | fw/lib/fw/application.ex | nerves-build/skeleton | d7cd9391471eea27ec6deac4abbb7872a61c6c43 | [
"MIT"
] | null | null | null | fw/lib/fw/application.ex | nerves-build/skeleton | d7cd9391471eea27ec6deac4abbb7872a61c6c43 | [
"MIT"
] | null | null | null | fw/lib/fw/application.ex | nerves-build/skeleton | d7cd9391471eea27ec6deac4abbb7872a61c6c43 | [
"MIT"
] | null | null | null | defmodule Fw.Application do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
# Define workers and child supervisors to be supervised
children = [
# worker(Fw.Worker, [arg1, arg2, arg3]),
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Fw.Supervisor]
Supervisor.start_link(children, opts)
end
end
| 29.3 | 67 | 0.711604 |
9e88ee1a7463dcd062c358908d1569506a21e266 | 1,222 | exs | Elixir | config/config.exs | christophermlne/fuentes | 9445ccdfd1c2f3707a39cf9bf63b4627581bc048 | [
"Apache-2.0"
] | 30 | 2016-05-26T23:30:03.000Z | 2022-03-10T18:44:37.000Z | config/config.exs | christophermlne/fuentes | 9445ccdfd1c2f3707a39cf9bf63b4627581bc048 | [
"Apache-2.0"
] | 3 | 2016-05-20T14:55:40.000Z | 2020-03-18T11:59:47.000Z | config/config.exs | christophermlne/fuentes | 9445ccdfd1c2f3707a39cf9bf63b4627581bc048 | [
"Apache-2.0"
] | 6 | 2016-09-27T11:19:56.000Z | 2019-09-26T07:30:30.000Z | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
#config :fuentes
#import_config "#{Mix.env}.exs"
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the parent project. For this reason,
# if you want to provide default values for your application for
# 3rd-party users, it should be done in your "mix.exs" file.
# You can configure for your application as:
#
# config :fuentes, key: :value
#
# And access this configuration in your application as:
#
# Application.get_env(:fuentes, :key)
#
# Or configure a 3rd-party app:
#
# config :logger, level: :info
#
# It is also possible to import configuration files, relative to this
# directory. For example, you can emulate configuration per environment
# by uncommenting the line below and defining dev.exs, test.exs and such.
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"
if Mix.env == :test do
import_config "test.exs"
end
| 32.157895 | 73 | 0.745499 |
9e88f85fb809376fefb552c99e5514612ca5eb7b | 67,752 | ex | Elixir | lib/rethinkdb/query.ex | scottdavis/rethinkdb-elixir | 28727810d6af07f07056082ce471be90cb10f4a0 | [
"MIT"
] | 6 | 2018-09-21T09:15:06.000Z | 2020-12-05T21:50:35.000Z | lib/rethinkdb/query.ex | scottdavis/rethinkdb-elixir | 28727810d6af07f07056082ce471be90cb10f4a0 | [
"MIT"
] | 44 | 2018-09-25T13:16:41.000Z | 2021-08-02T13:14:38.000Z | lib/rethinkdb/query.ex | scottdavis/rethinkdb-elixir | 28727810d6af07f07056082ce471be90cb10f4a0 | [
"MIT"
] | 3 | 2019-03-13T03:11:47.000Z | 2020-12-15T00:50:54.000Z | defmodule RethinkDB.Query do
@moduledoc """
Querying API for RethinkDB
"""
alias RethinkDB.Q
import RethinkDB.Query.Macros
@type t :: %Q{}
@type reql_string :: String.t() | t
@type reql_number :: integer | float | t
@type reql_array :: [term] | t
@type reql_bool :: boolean | t
@type reql_obj :: map | t
@type reql_datum :: term
@type reql_func0 :: (() -> term) | t
@type reql_func1 :: (term -> term) | t
@type reql_func2 :: (term, term -> term) | t
@type reql_opts :: map
@type reql_binary :: %RethinkDB.Pseudotypes.Binary{} | binary | t
@type reql_geo_point :: %RethinkDB.Pseudotypes.Geometry.Point{} | {reql_number, reql_number} | t
@type reql_geo_line :: %RethinkDB.Pseudotypes.Geometry.Line{} | t
@type reql_geo_polygon :: %RethinkDB.Pseudotypes.Geometry.Polygon{} | t
@type reql_geo :: reql_geo_point | reql_geo_line | reql_geo_polygon
@type reql_time :: %RethinkDB.Pseudotypes.Time{} | t
#
# Aggregation Functions
#
@doc """
Takes a stream and partitions it into multiple groups based on the fields or
functions provided.
With the multi flag single documents can be assigned to multiple groups,
similar to the behavior of multi-indexes. When multi is True and the grouping
value is an array, documents will be placed in each group that corresponds to
the elements of the array. If the array is empty the row will be ignored.
"""
@spec group(
Q.reql_array(),
Q.reql_func1() | Q.reql_string() | [Q.reql_func1() | Q.reql_string()]
) :: Q.t()
operate_on_seq_and_list(:group, 144, opts: true)
operate_on_two_args(:group, 144, opts: true)
@doc """
Takes a grouped stream or grouped data and turns it into an array of objects
representing the groups. Any commands chained after ungroup will operate on
this array, rather than operating on each group individually. This is useful if
you want to e.g. order the groups by the value of their reduction.
The format of the array returned by ungroup is the same as the default native
format of grouped data in the JavaScript driver and data explorer.
end
"""
@spec ungroup(Q.t()) :: Q.t()
operate_on_single_arg(:ungroup, 150)
@doc """
Produce a single value from a sequence through repeated application of a
reduction function.
The reduction function can be called on:
* two elements of the sequence
* one element of the sequence and one result of a previous reduction
* two results of previous reductions
The reduction function can be called on the results of two previous
reductions because the reduce command is distributed and parallelized across
shards and CPU cores. A common mistaken when using the reduce command is to
suppose that the reduction is executed from left to right.
"""
@spec reduce(Q.reql_array(), Q.reql_func2()) :: Q.t()
operate_on_two_args(:reduce, 37)
@doc """
Counts the number of elements in a sequence. If called with a value, counts
the number of times that value occurs in the sequence. If called with a
predicate function, counts the number of elements in the sequence where that
function returns `true`.
If count is called on a binary object, it will return the size of the object
in bytes.
"""
@spec count(Q.reql_array()) :: Q.t()
operate_on_single_arg(:count, 43)
@spec count(Q.reql_array(), Q.reql_string() | Q.reql_func1()) :: Q.t()
operate_on_two_args(:count, 43)
@doc """
Sums all the elements of a sequence. If called with a field name, sums all
the values of that field in the sequence, skipping elements of the sequence
that lack that field. If called with a function, calls that function on every
element of the sequence and sums the results, skipping elements of the sequence
where that function returns `nil` or a non-existence error.
Returns 0 when called on an empty sequence.
"""
@spec sum(Q.reql_array()) :: Q.t()
operate_on_single_arg(:sum, 145)
@spec sum(Q.reql_array(), Q.reql_string() | Q.reql_func1()) :: Q.t()
operate_on_two_args(:sum, 145)
@doc """
Averages all the elements of a sequence. If called with a field name,
averages all the values of that field in the sequence, skipping elements of the
sequence that lack that field. If called with a function, calls that function
on every element of the sequence and averages the results, skipping elements of
the sequence where that function returns None or a non-existence error.
Produces a non-existence error when called on an empty sequence. You can
handle this case with `default`.
"""
@spec avg(Q.reql_array()) :: Q.t()
operate_on_single_arg(:avg, 146)
@spec avg(Q.reql_array(), Q.reql_string() | Q.reql_func1()) :: Q.t()
operate_on_two_args(:avg, 146)
@doc """
Finds the minimum element of a sequence. The min command can be called with:
* a field name, to return the element of the sequence with the smallest value in
that field;
* an index option, to return the element of the sequence with the smallest value in that
index;
* a function, to apply the function to every element within the sequence and
return the element which returns the smallest value from the function, ignoring
any elements where the function returns None or produces a non-existence error.
Calling min on an empty sequence will throw a non-existence error; this can be
handled using the `default` command.
"""
@spec min(Q.reql_array(), Q.reql_opts() | Q.reql_string() | Q.reql_func1()) :: Q.t()
operate_on_single_arg(:min, 147)
operate_on_two_args(:min, 147)
@doc """
Finds the maximum element of a sequence. The max command can be called with:
* a field name, to return the element of the sequence with the smallest value in
that field;
* an index, to return the element of the sequence with the smallest value in that
index;
* a function, to apply the function to every element within the sequence and
return the element which returns the smallest value from the function, ignoring
any elements where the function returns None or produces a non-existence error.
Calling max on an empty sequence will throw a non-existence error; this can be
handled using the `default` command.
"""
@spec max(Q.reql_array(), Q.reql_opts() | Q.reql_string() | Q.reql_func1()) :: Q.t()
operate_on_single_arg(:max, 148)
operate_on_two_args(:max, 148)
@doc """
Removes duplicates from elements in a sequence.
The distinct command can be called on any sequence, a table, or called on a
table with an index.
"""
@spec distinct(Q.reql_array(), Q.reql_opts()) :: Q.t()
operate_on_single_arg(:distinct, 42, opts: true)
@doc """
When called with values, returns `true` if a sequence contains all the specified
values. When called with predicate functions, returns `true` if for each
predicate there exists at least one element of the stream where that predicate
returns `true`.
"""
@spec contains(Q.reql_array(), Q.reql_array() | Q.reql_func1() | Q.t()) :: Q.t()
operate_on_seq_and_list(:contains, 93)
operate_on_two_args(:contains, 93)
#
# Control Strucutres
#
@doc """
`args` is a special term that’s used to splice an array of arguments into
another term. This is useful when you want to call a variadic term such as
`get_all` with a set of arguments produced at runtime.
This is analogous to Elixir's `apply`.
"""
@spec args(Q.reql_array()) :: Q.t()
operate_on_single_arg(:args, 154)
@doc """
Encapsulate binary data within a query.
The type of data binary accepts depends on the client language. In
Elixir, it expects a Binary. Using a Binary object within a query implies
the use of binary and the ReQL driver will automatically perform the coercion.
Binary objects returned to the client in Elixir will also be
Binary objects. This can be changed with the binary_format option :raw
to run to return “raw” objects.
Only a limited subset of ReQL commands may be chained after binary:
* coerce_to can coerce binary objects to string types
* count will return the number of bytes in the object
* slice will treat bytes like array indexes (i.e., slice(10,20) will return bytes
* 10–19)
* type_of returns PTYPE<BINARY>
* info will return information on a binary object.
"""
@spec binary(Q.reql_binary()) :: Q.t()
def binary(%RethinkDB.Pseudotypes.Binary{data: data}), do: do_binary(data)
def binary(data), do: do_binary(:base64.encode(data))
def do_binary(data), do: %Q{query: [155, [%{"$reql_type$" => "BINARY", "data" => data}]]}
@doc """
Call an anonymous function using return values from other ReQL commands or
queries as arguments.
The last argument to do (or, in some forms, the only argument) is an expression
or an anonymous function which receives values from either the previous
arguments or from prefixed commands chained before do. The do command is
essentially a single-element map, letting you map a function over just one
document. This allows you to bind a query result to a local variable within the
scope of do, letting you compute the result just once and reuse it in a complex
expression or in a series of ReQL commands.
Arguments passed to the do function must be basic data types, and cannot be
streams or selections. (Read about ReQL data types.) While the arguments will
all be evaluated before the function is executed, they may be evaluated in any
order, so their values should not be dependent on one another. The type of do’s
result is the type of the value returned from the function or last expression.
"""
@spec do_r(Q.reql_datum() | Q.reql_func0(), Q.reql_func1()) :: Q.t()
operate_on_single_arg(:do_r, 64)
# Can't do `operate_on_two_args` because we swap the order of args to make it
# Elixir's idiomatic subject first order.
def do_r(data, f) when is_function(f), do: %Q{query: [64, [wrap(f), wrap(data)]]}
@doc """
If the `test` expression returns False or None, the false_branch will be
evaluated. Otherwise, the true_branch will be evaluated.
The branch command is effectively an if renamed due to language constraints.
"""
@spec branch(Q.reql_datum(), Q.reql_datum(), Q.reql_datum()) :: Q.t()
operate_on_three_args(:branch, 65)
@doc """
Loop over a sequence, evaluating the given write query for each element.
"""
@spec for_each(Q.reql_array(), Q.reql_func1()) :: Q.t()
operate_on_two_args(:for_each, 68)
@doc """
Generate a stream of sequential integers in a specified range.
`range` takes 0, 1 or 2 arguments:
* With no arguments, range returns an “infinite” stream from 0 up to and
including the maximum integer value;
* With one argument, range returns a stream from 0 up to but not
including the end value;
* With two arguments, range returns a stream from the start value up to
but not including the end value.
"""
@spec range(Q.reql_number(), Q.req_number()) :: Q.t()
operate_on_zero_args(:range, 173)
operate_on_single_arg(:range, 173)
operate_on_two_args(:range, 173)
@doc """
Throw a runtime error.
"""
@spec error(Q.reql_string()) :: Q.t()
operate_on_single_arg(:error, 12)
@doc """
Handle non-existence errors. Tries to evaluate and return its first argument.
If an error related to the absence of a value is thrown in the process, or if
its first argument returns nil, returns its second argument. (Alternatively,
the second argument may be a function which will be called with either the text
of the non-existence error or nil.)
"""
@spec default(Q.t(), Q.t()) :: Q.t()
operate_on_two_args(:default, 92)
@doc """
Create a javascript expression.
The only opt allowed is `timeout`.
`timeout` is the number of seconds before `js` times out. The default value
is 5 seconds.
"""
@spec js(Q.reql_string(), Q.opts()) :: Q.t()
operate_on_single_arg(:js, 11, opts: true)
@doc """
Convert a value of one type into another.
* a sequence, selection or object can be coerced to an array
* an array of key-value pairs can be coerced to an object
* a string can be coerced to a number
* any datum (single value) can be coerced to a string
* a binary object can be coerced to a string and vice-versa
"""
@spec coerce_to(Q.reql_datum(), Q.reql_string()) :: Q.t()
operate_on_two_args(:coerce_to, 51)
@doc """
Gets the type of a value.
"""
@spec type_of(Q.reql_datum()) :: Q.t()
operate_on_single_arg(:type_of, 52)
@doc """
Get information about a ReQL value.
"""
@spec info(Q.t()) :: Q.t()
operate_on_single_arg(:info, 79)
@doc """
Parse a JSON string on the server.
"""
@spec json(Q.reql_string()) :: Q.t()
operate_on_single_arg(:json, 98)
@doc """
Serialize to JSON string on the server.
"""
@spec to_json(Q.reql_term()) :: Q.t()
operate_on_single_arg(:to_json, 172)
@doc """
Retrieve data from the specified URL over HTTP. The return type depends on
the result_format option, which checks the Content-Type of the response by
default.
"""
@spec http(Q.reql_string(), Q.reql_opts()) :: Q.t()
operate_on_single_arg(:http, 153, opts: true)
@doc """
Return a UUID (universally unique identifier), a string that can be used as a unique ID.
Accepts optionally a string. If given, UUID will be derived from the strings SHA-1 hash.
"""
@spec uuid(Q.reql_string()) :: Q.t()
operate_on_zero_args(:uuid, 169)
operate_on_single_arg(:uuid, 169)
#
# Database Operations
#
@doc """
Create a database. A RethinkDB database is a collection of tables, similar to
relational databases.
If successful, the command returns an object with two fields:
* dbs_created: always 1.
* config_changes: a list containing one object with two fields, old_val and
new_val:
* old_val: always null.
* new_val: the database’s new config value.
If a database with the same name already exists, the command throws
RqlRuntimeError.
Note: Only alphanumeric characters and underscores are valid for the database
name.
"""
@spec db_create(Q.reql_string()) :: Q.t()
operate_on_single_arg(:db_create, 57)
@doc """
Drop a database. The database, all its tables, and corresponding data will be deleted.
If successful, the command returns an object with two fields:
* dbs_dropped: always 1.
* tables_dropped: the number of tables in the dropped database.
* config_changes: a list containing one two-field object, old_val and new_val:
* old_val: the database’s original config value.
* new_val: always None.
If the given database does not exist, the command throws RqlRuntimeError.
"""
@spec db_drop(Q.reql_string()) :: Q.t()
operate_on_single_arg(:db_drop, 58)
@doc """
List all database names in the system. The result is a list of strings.
"""
@spec db_list :: Q.t()
operate_on_zero_args(:db_list, 59)
#
# Geospatial Queries
#
@doc """
Construct a circular line or polygon. A circle in RethinkDB is a polygon or
line approximating a circle of a given radius around a given center, consisting
of a specified number of vertices (default 32).
The center may be specified either by two floating point numbers, the latitude
(−90 to 90) and longitude (−180 to 180) of the point on a perfect sphere (see
Geospatial support for more information on ReQL’s coordinate system), or by a
point object. The radius is a floating point number whose units are meters by
default, although that may be changed with the unit argument.
Optional arguments available with circle are:
- num_vertices: the number of vertices in the polygon or line. Defaults to 32.
- geo_system: the reference ellipsoid to use for geographic coordinates. Possible
values are WGS84 (the default), a common standard for Earth’s geometry, or
unit_sphere, a perfect sphere of 1 meter radius.
- unit: Unit for the radius distance. Possible values are m (meter, the default),
km (kilometer), mi (international mile), nm (nautical mile), ft (international
foot).
- fill: if `true` (the default) the circle is filled, creating a polygon; if `false`
the circle is unfilled (creating a line).
"""
@spec circle(Q.reql_geo(), Q.reql_number(), Q.reql_opts()) :: Q.t()
operate_on_two_args(:circle, 165, opts: true)
@doc """
Compute the distance between a point and another geometry object. At least one
of the geometry objects specified must be a point.
Optional arguments available with distance are:
- geo_system: the reference ellipsoid to use for geographic coordinates. Possible
values are WGS84 (the default), a common standard for Earth’s geometry, or
unit_sphere, a perfect sphere of 1 meter radius.
- unit: Unit to return the distance in. Possible values are m (meter, the
default), km (kilometer), mi (international mile), nm (nautical mile), ft
(international foot).
If one of the objects is a polygon or a line, the point will be projected onto
the line or polygon assuming a perfect sphere model before the distance is
computed (using the model specified with geo_system). As a consequence, if the
polygon or line is extremely large compared to Earth’s radius and the distance
is being computed with the default WGS84 model, the results of distance should
be considered approximate due to the deviation between the ellipsoid and
spherical models.
"""
@spec distance(Q.reql_geo(), Q.reql_geo(), Q.reql_opts()) :: Q.t()
operate_on_two_args(:distance, 162, opts: true)
@doc """
Convert a Line object into a Polygon object. If the last point does not
specify the same coordinates as the first point, polygon will close the polygon
by connecting them.
"""
@spec fill(Q.reql_line()) :: Q.t()
operate_on_single_arg(:fill, 167)
@doc """
Convert a GeoJSON object to a ReQL geometry object.
RethinkDB only allows conversion of GeoJSON objects which have ReQL
equivalents: Point, LineString, and Polygon. MultiPoint, MultiLineString, and
MultiPolygon are not supported. (You could, however, store multiple points,
lines and polygons in an array and use a geospatial multi index with them.)
Only longitude/latitude coordinates are supported. GeoJSON objects that use
Cartesian coordinates, specify an altitude, or specify their own coordinate
reference system will be rejected.
"""
@spec geojson(Q.reql_obj()) :: Q.t()
operate_on_single_arg(:geojson, 157)
@doc """
Convert a ReQL geometry object to a GeoJSON object.
"""
@spec to_geojson(Q.reql_obj()) :: Q.t()
operate_on_single_arg(:to_geojson, 158)
@doc """
Get all documents where the given geometry object intersects the geometry
object of the requested geospatial index.
The index argument is mandatory. This command returns the same results as
`filter(r.row('index')) |> intersects(geometry)`. The total number of results
is limited to the array size limit which defaults to 100,000, but can be
changed with the `array_limit` option to run.
"""
@spec get_intersecting(Q.reql_array(), Q.reql_geo(), Q.reql_opts()) :: Q.t()
operate_on_two_args(:get_intersecting, 166, opts: true)
@doc """
Get all documents where the specified geospatial index is within a certain
distance of the specified point (default 100 kilometers).
The index argument is mandatory. Optional arguments are:
* max_results: the maximum number of results to return (default 100).
* unit: Unit for the distance. Possible values are m (meter, the default), km
(kilometer), mi (international mile), nm (nautical mile), ft (international
foot).
* max_dist: the maximum distance from an object to the specified point (default
100 km).
* geo_system: the reference ellipsoid to use for geographic coordinates. Possible
values are WGS84 (the default), a common standard for Earth’s geometry, or
unit_sphere, a perfect sphere of 1 meter radius.
The return value will be an array of two-item objects with the keys dist and
doc, set to the distance between the specified point and the document (in the
units specified with unit, defaulting to meters) and the document itself,
respectively.
"""
@spec get_nearest(Q.reql_array(), Q.reql_geo(), Q.reql_opts()) :: Q.t()
operate_on_two_args(:get_nearest, 168, opts: true)
@doc """
Tests whether a geometry object is completely contained within another. When
applied to a sequence of geometry objects, includes acts as a filter, returning
a sequence of objects from the sequence that include the argument.
"""
@spec includes(Q.reql_geo(), Q.reql_geo()) :: Q.t()
operate_on_two_args(:includes, 164)
@doc """
Tests whether two geometry objects intersect with one another. When applied to
a sequence of geometry objects, intersects acts as a filter, returning a
sequence of objects from the sequence that intersect with the argument.
"""
@spec intersects(Q.reql_geo(), Q.reql_geo()) :: Q.t()
operate_on_two_args(:intersects, 163)
@doc """
Construct a geometry object of type Line. The line can be specified in one of
two ways:
- Two or more two-item arrays, specifying latitude and longitude numbers of the
line’s vertices;
- Two or more Point objects specifying the line’s vertices.
"""
@spec line([Q.reql_geo()]) :: Q.t()
operate_on_list(:line, 160)
@doc """
Construct a geometry object of type Point. The point is specified by two
floating point numbers, the longitude (−180 to 180) and latitude (−90 to 90) of
the point on a perfect sphere.
"""
@spec point(Q.reql_geo()) :: Q.t()
def point({la, lo}), do: point(la, lo)
operate_on_two_args(:point, 159)
@doc """
Construct a geometry object of type Polygon. The Polygon can be specified in
one of two ways:
Three or more two-item arrays, specifying latitude and longitude numbers of the
polygon’s vertices;
* Three or more Point objects specifying the polygon’s vertices.
* Longitude (−180 to 180) and latitude (−90 to 90) of vertices are plotted on a
perfect sphere. See Geospatial support for more information on ReQL’s
coordinate system.
If the last point does not specify the same coordinates as the first point,
polygon will close the polygon by connecting them. You cannot directly
construct a polygon with holes in it using polygon, but you can use polygon_sub
to use a second polygon within the interior of the first to define a hole.
"""
@spec polygon([Q.reql_geo()]) :: Q.t()
operate_on_list(:polygon, 161)
@doc """
Use polygon2 to “punch out” a hole in polygon1. polygon2 must be completely
contained within polygon1 and must have no holes itself (it must not be the
output of polygon_sub itself).
"""
@spec polygon_sub(Q.reql_geo(), Q.reql_geo()) :: Q.t()
operate_on_two_args(:polygon_sub, 171)
#
# Joins Queries
#
@doc """
Returns an inner join of two sequences. The returned sequence represents an
intersection of the left-hand sequence and the right-hand sequence: each row of
the left-hand sequence will be compared with each row of the right-hand
sequence to find all pairs of rows which satisfy the predicate. Each matched
pair of rows of both sequences are combined into a result row. In most cases,
you will want to follow the join with `zip` to combine the left and right results.
Note that `inner_join` is slower and much less efficient than using `eqJoin` or
`flat_map` with `get_all`. You should avoid using `inner_join` in commands when
possible.
iex> table("people") |> inner_join(
table("phone_numbers"), &(eq(&1["id"], &2["person_id"])
) |> run
"""
@spec inner_join(Q.reql_array(), Q.reql_array(), Q.reql_func2()) :: Q.t()
operate_on_three_args(:inner_join, 48)
@doc """
Returns a left outer join of two sequences. The returned sequence represents
a union of the left-hand sequence and the right-hand sequence: all documents in
the left-hand sequence will be returned, each matched with a document in the
right-hand sequence if one satisfies the predicate condition. In most cases,
you will want to follow the join with `zip` to combine the left and right results.
Note that `outer_join` is slower and much less efficient than using `flat_map`
with `get_all`. You should avoid using `outer_join` in commands when possible.
iex> table("people") |> outer_join(
table("phone_numbers"), &(eq(&1["id"], &2["person_id"])
) |> run
"""
@spec outer_join(Q.reql_array(), Q.reql_array(), Q.reql_func2()) :: Q.t()
operate_on_three_args(:outer_join, 49)
@doc """
Join tables using a field on the left-hand sequence matching primary keys or
secondary indexes on the right-hand table. `eq_join` is more efficient than other
ReQL join types, and operates much faster. Documents in the result set consist
of pairs of left-hand and right-hand documents, matched when the field on the
left-hand side exists and is non-null and an entry with that field’s value
exists in the specified index on the right-hand side.
The result set of `eq_join` is a stream or array of objects. Each object in the
returned set will be an object of the form `{ left: <left-document>, right:
<right-document> }`, where the values of left and right will be the joined
documents. Use the zip command to merge the left and right fields together.
iex> table("people") |> eq_join(
"id", table("phone_numbers"), %{index: "person_id"}
) |> run
"""
@spec eq_join(Q.reql_array(), Q.reql_string(), Q.reql_array(), Keyword.t()) :: Q.t()
operate_on_three_args(:eq_join, 50, opts: true)
@doc """
Used to ‘zip’ up the result of a join by merging the ‘right’ fields into
‘left’ fields of each member of the sequence.
iex> table("people") |> eq_join(
"id", table("phone_numbers"), %{index: "person_id"}
) |> zip |> run
"""
@spec zip(Q.reql_array()) :: Q.t()
operate_on_single_arg(:zip, 72)
#
# Math and Logic Queries
#
@doc """
Sum two numbers, concatenate two strings, or concatenate 2 arrays.
iex> add(1, 2) |> run conn
%RethinkDB.Record{data: 3}
iex> add("hello", " world") |> run conn
%RethinkDB.Record{data: "hello world"}
iex> add([1,2], [3,4]) |> run conn
%RethinkDB.Record{data: [1,2,3,4]}
"""
@spec add(Q.reql_number() | Q.reql_string(), Q.reql_number() | Q.reql_string()) :: Q.t()
operate_on_two_args(:add, 24)
@doc """
Add multiple values or concatenate multiple strings or arrays.
iex> add([1, 2]) |> run conn
%RethinkDB.Record{data: 3}
iex> add(["hello", " world"]) |> run
%RethinkDB.Record{data: "hello world"}
iex> add(args([10,20,30])) |> run conn
%RethinkDB.Record{data: 60}
iex> add(args([[1, 2], [3, 4]])) |> run conn
%RethinkDB.Record{data: [1, 2, 3, 4]}
"""
@spec add([Q.reql_number() | Q.reql_string() | Q.reql_array()] | Q.t()) :: Q.t()
operate_on_list(:add, 24)
operate_on_single_arg(:add, 24)
@doc """
Subtract two numbers.
iex> sub(1, 2) |> run conn
%RethinkDB.Record{data: -1}
"""
@spec sub(Q.reql_number(), Q.reql_number()) :: Q.t()
operate_on_two_args(:sub, 25)
@doc """
Subtract multiple values. Left associative.
iex> sub([9, 1, 2]) |> run conn
%RethinkDB.Record{data: 6}
"""
@spec sub([Q.reql_number()]) :: Q.t()
operate_on_list(:sub, 25)
@doc """
Multiply two numbers, or make a periodic array.
iex> mul(2,3) |> run conn
%RethinkDB.Record{data: 6}
iex> mul([1,2], 2) |> run conn
%RethinkDB.Record{data: [1,2,1,2]}
"""
@spec mul(Q.reql_number() | Q.reql_array(), Q.reql_number() | Q.reql_array()) :: Q.t()
operate_on_two_args(:mul, 26)
@doc """
Multiply multiple values.
iex> mul([2,3,4]) |> run conn
%RethinkDB.Record{data: 24}
"""
@spec mul([Q.reql_number() | Q.reql_array()]) :: Q.t()
operate_on_list(:mul, 26)
@doc """
Divide two numbers.
iex> divide(12, 4) |> run conn
%RethinkDB.Record{data: 3}
"""
@spec divide(Q.reql_number(), Q.reql_number()) :: Q.t()
operate_on_two_args(:divide, 27)
@doc """
Divide a list of numbers. Left associative.
iex> divide([12, 2, 3]) |> run conn
%RethinkDB.Record{data: 2}
"""
@spec divide([Q.reql_number()]) :: Q.t()
operate_on_list(:divide, 27)
@doc """
Find the remainder when dividing two numbers.
iex> mod(23, 4) |> run conn
%RethinkDB.Record{data: 3}
"""
@spec mod(Q.reql_number(), Q.reql_number()) :: Q.t()
operate_on_two_args(:mod, 28)
@doc """
Compute the logical “and” of two values.
iex> and(true, true) |> run conn
%RethinkDB.Record{data: true}
iex> and(false, true) |> run conn
%RethinkDB.Record{data: false}
"""
@spec and_r(Q.reql_bool(), Q.reql_bool()) :: Q.t()
operate_on_two_args(:and_r, 67)
@doc """
Compute the logical “and” of all values in a list.
iex> and_r([true, true, true]) |> run conn
%RethinkDB.Record{data: true}
iex> and_r([false, true, true]) |> run conn
%RethinkDB.Record{data: false}
"""
@spec and_r([Q.reql_bool()]) :: Q.t()
operate_on_list(:and_r, 67)
@doc """
Compute the logical “or” of two values.
iex> or_r(true, false) |> run conn
%RethinkDB.Record{data: true}
iex> or_r(false, false) |> run conn
%RethinkDB.Record{data: false}
"""
@spec or_r(Q.reql_bool(), Q.reql_bool()) :: Q.t()
operate_on_two_args(:or_r, 66)
@doc """
Compute the logical “or” of all values in a list.
iex> or_r([true, true, true]) |> run conn
%RethinkDB.Record{data: true}
iex> or_r([false, true, true]) |> run conn
%RethinkDB.Record{data: false}
"""
@spec or_r([Q.reql_bool()]) :: Q.t()
operate_on_list(:or_r, 66)
@doc """
Test if two values are equal.
iex> eq(1,1) |> run conn
%RethinkDB.Record{data: true}
iex> eq(1, 2) |> run conn
%RethinkDB.Record{data: false}
"""
@spec eq(Q.reql_datum(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:eq, 17)
@doc """
Test if all values in a list are equal.
iex> eq([2, 2, 2]) |> run conn
%RethinkDB.Record{data: true}
iex> eq([2, 1, 2]) |> run conn
%RethinkDB.Record{data: false}
"""
@spec eq([Q.reql_datum()]) :: Q.t()
operate_on_list(:eq, 17)
@doc """
Test if two values are not equal.
iex> ne(1,1) |> run conn
%RethinkDB.Record{data: false}
iex> ne(1, 2) |> run conn
%RethinkDB.Record{data: true}
"""
@spec ne(Q.reql_datum(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:ne, 18)
@doc """
Test if all values in a list are not equal.
iex> ne([2, 2, 2]) |> run conn
%RethinkDB.Record{data: false}
iex> ne([2, 1, 2]) |> run conn
%RethinkDB.Record{data: true}
"""
@spec ne([Q.reql_datum()]) :: Q.t()
operate_on_list(:ne, 18)
@doc """
Test if one value is less than the other.
iex> lt(2,1) |> run conn
%RethinkDB.Record{data: false}
iex> lt(1, 2) |> run conn
%RethinkDB.Record{data: true}
"""
@spec lt(Q.reql_datum(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:lt, 19)
@doc """
Test if all values in a list are less than the next. Left associative.
iex> lt([1, 4, 2]) |> run conn
%RethinkDB.Record{data: false}
iex> lt([1, 4, 5]) |> run conn
%RethinkDB.Record{data: true}
"""
@spec lt([Q.reql_datum()]) :: Q.t()
operate_on_list(:lt, 19)
@doc """
Test if one value is less than or equal to the other.
iex> le(1,1) |> run conn
%RethinkDB.Record{data: true}
iex> le(1, 2) |> run conn
%RethinkDB.Record{data: true}
"""
@spec le(Q.reql_datum(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:le, 20)
@doc """
Test if all values in a list are less than or equal to the next. Left associative.
iex> le([1, 4, 2]) |> run conn
%RethinkDB.Record{data: false}
iex> le([1, 4, 4]) |> run conn
%RethinkDB.Record{data: true}
"""
@spec le([Q.reql_datum()]) :: Q.t()
operate_on_list(:le, 20)
@doc """
Test if one value is greater than the other.
iex> gt(1,2) |> run conn
%RethinkDB.Record{data: false}
iex> gt(2,1) |> run conn
%RethinkDB.Record{data: true}
"""
@spec gt(Q.reql_datum(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:gt, 21)
@doc """
Test if all values in a list are greater than the next. Left associative.
iex> gt([1, 4, 2]) |> run conn
%RethinkDB.Record{data: false}
iex> gt([10, 4, 2]) |> run conn
%RethinkDB.Record{data: true}
"""
@spec gt([Q.reql_datum()]) :: Q.t()
operate_on_list(:gt, 21)
@doc """
Test if one value is greater than or equal to the other.
iex> ge(1,1) |> run conn
%RethinkDB.Record{data: true}
iex> ge(2, 1) |> run conn
%RethinkDB.Record{data: true}
"""
@spec ge(Q.reql_datum(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:ge, 22)
@doc """
Test if all values in a list are greater than or equal to the next. Left associative.
iex> le([1, 4, 2]) |> run conn
%RethinkDB.Record{data: false}
iex> le([10, 4, 4]) |> run conn
%RethinkDB.Record{data: true}
"""
@spec ge([Q.reql_datum()]) :: Q.t()
operate_on_list(:ge, 22)
@doc """
Compute the logical inverse (not) of an expression.
iex> not(true) |> run conn
%RethinkDB.Record{data: false}
"""
@spec not_r(Q.reql_bool()) :: Q.t()
operate_on_single_arg(:not_r, 23)
@doc """
Generate a random float between 0 and 1.
iex> random |> run conn
%RethinkDB.Record{data: 0.43}
"""
@spec random :: Q.t()
operate_on_zero_args(:random, 151)
@doc """
Generate a random value in the range [0,upper). If upper is an integer then the
random value will be an integer. If upper is a float it will be a float.
iex> random(5) |> run conn
%RethinkDB.Record{data: 3}
iex> random(5.0) |> run conn
%RethinkDB.Record{data: 3.7}
"""
@spec random(Q.reql_number()) :: Q.t()
def random(upper) when is_float(upper), do: random(upper, float: true)
operate_on_single_arg(:random, 151, opts: true)
@doc """
Generate a random value in the range [lower,upper). If either arg is an integer then the
random value will be an interger. If one of them is a float it will be a float.
iex> random(5, 10) |> run conn
%RethinkDB.Record{data: 8}
iex> random(5.0, 15.0,) |> run conn
%RethinkDB.Record{data: 8.34}
"""
@spec random(Q.reql_number(), Q.reql_number()) :: Q.t()
def random(lower, upper) when is_float(lower) or is_float(upper) do
random(lower, upper, float: true)
end
operate_on_two_args(:random, 151, opts: true)
@doc """
Rounds the given value to the nearest whole integer.
For example, values of 1.0 up to but not including 1.5 will return 1.0, similar to floor; values of 1.5 up to 2.0 will return 2.0, similar to ceil.
"""
@spec round_r(Q.reql_number()) :: Q.t()
operate_on_single_arg(:round_r, 185)
@doc """
Rounds the given value up, returning the smallest integer value greater than or equal to the given value (the value’s ceiling).
"""
@spec ceil(Q.reql_number()) :: Q.t()
operate_on_single_arg(:ceil, 184)
@doc """
Rounds the given value down, returning the largest integer value less than or equal to the given value (the value’s floor).
"""
@spec floor(Q.reql_number()) :: Q.t()
operate_on_single_arg(:floor, 183)
#
# Selection Queries
#
@doc """
Reference a database.
"""
@spec db(Q.reql_string()) :: Q.t()
operate_on_single_arg(:db, 14)
@doc """
Return all documents in a table. Other commands may be chained after table to
return a subset of documents (such as get and filter) or perform further
processing.
There are two optional arguments.
* useOutdated: if true, this allows potentially out-of-date data to be returned,
with potentially faster reads. It also allows you to perform reads from a
secondary replica if a primary has failed. Default false.
* identifierFormat: possible values are name and uuid, with a default of name. If
set to uuid, then system tables will refer to servers, databases and tables by
UUID rather than name. (This only has an effect when used with system tables.)
"""
@spec table(Q.reql_string(), Q.reql_opts()) :: Q.t()
@spec table(Q.t(), Q.reql_string(), Q.reql_opts()) :: Q.t()
operate_on_single_arg(:table, 15, opts: true)
operate_on_two_args(:table, 15, opts: true)
@doc """
Get a document by primary key.
If no document exists with that primary key, get will return nil.
"""
@spec get(Q.t(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:get, 16)
@doc """
Get all documents where the given value matches the value of the requested index.
"""
@spec get_all(Q.t(), Q.reql_array()) :: Q.t()
operate_on_seq_and_list(:get_all, 78, opts: true)
operate_on_two_args(:get_all, 78, opts: true)
@doc """
Get all documents between two keys. Accepts three optional arguments: index,
left_bound, and right_bound. If index is set to the name of a secondary index,
between will return all documents where that index’s value is in the specified
range (it uses the primary key by default). left_bound or right_bound may be
set to open or closed to indicate whether or not to include that endpoint of
the range (by default, left_bound is closed and right_bound is open).
"""
@spec between(Q.reql_array(), Q.t(), Q.t()) :: Q.t()
operate_on_three_args(:between, 182, opts: true)
@doc """
Get all the documents for which the given predicate is true.
filter can be called on a sequence, selection, or a field containing an array
of elements. The return type is the same as the type on which the function was
called on.
The body of every filter is wrapped in an implicit .default(False), which means
that if a non-existence errors is thrown (when you try to access a field that
does not exist in a document), RethinkDB will just ignore the document. The
default value can be changed by passing the named argument default. Setting
this optional argument to r.error() will cause any non-existence errors to
return a RqlRuntimeError.
"""
@spec filter(Q.reql_array(), Q.t()) :: Q.t()
operate_on_two_args(:filter, 39, opts: true)
#
# String Manipulation Queries
#
@doc """
Checks a string for matches.
Example:
iex> "hello world" |> match("hello") |> run conn
iex> "hello world" |> match(~r(hello)) |> run conn
"""
@spec match(Q.reql_string(), Regex.t() | Q.reql_string()) :: Q.t()
def match(string, regex = %Regex{}), do: match(string, Regex.source(regex))
operate_on_two_args(:match, 97)
@doc """
Split a `string` on whitespace.
iex> "abracadabra" |> split |> run conn
%RethinkDB.Record{data: ["abracadabra"]}
"""
@spec split(Q.reql_string()) :: Q.t()
operate_on_single_arg(:split, 149)
@doc """
Split a `string` on `separator`.
iex> "abra-cadabra" |> split("-") |> run conn
%RethinkDB.Record{data: ["abra", "cadabra"]}
"""
@spec split(Q.reql_string(), Q.reql_string()) :: Q.t()
operate_on_two_args(:split, 149)
@doc """
Split a `string` with a given `separator` into `max_result` segments.
iex> "a-bra-ca-da-bra" |> split("-", 2) |> run conn
%RethinkDB.Record{data: ["a", "bra", "ca-da-bra"]}
"""
@spec split(Q.reql_string(), Q.reql_string() | nil, integer) :: Q.t()
operate_on_three_args(:split, 149)
@doc """
Convert a string to all upper case.
iex> "hi" |> upcase |> run conn
%RethinkDB.Record{data: "HI"}
"""
@spec upcase(Q.reql_string()) :: Q.t()
operate_on_single_arg(:upcase, 141)
@doc """
Convert a string to all down case.
iex> "Hi" |> downcase |> run conn
%RethinkDB.Record{data: "hi"}
"""
@spec downcase(Q.reql_string()) :: Q.t()
operate_on_single_arg(:downcase, 142)
#
# Table Functions
#
@doc """
Create a table. A RethinkDB table is a collection of JSON documents.
If successful, the command returns an object with two fields:
* tables_created: always 1.
* config_changes: a list containing one two-field object, old_val and new_val:
* old_val: always nil.
* new_val: the table’s new config value.
If a table with the same name already exists, the command throws
RqlRuntimeError.
Note: Only alphanumeric characters and underscores are valid for the table name.
When creating a table you can specify the following options:
* primary_key: the name of the primary key. The default primary key is id.
* durability: if set to soft, writes will be acknowledged by the server
immediately and flushed to disk in the background. The default is hard:
acknowledgment of writes happens after data has been written to disk.
* shards: the number of shards, an integer from 1-32. Defaults to 1.
* replicas: either an integer or a mapping object. Defaults to 1.
If replicas is an integer, it specifies the number of replicas per shard.
Specifying more replicas than there are servers will return an error.
If replicas is an object, it specifies key-value pairs of server tags and the
number of replicas to assign to those servers: {:tag1 => 2, :tag2 => 4, :tag3
=> 2, ...}.
* primary_replica_tag: the primary server specified by its server tag. Required
if replicas is an object; the tag must be in the object. This must not be
specified if replicas is an integer.
The data type of a primary key is usually a string (like a UUID) or a number,
but it can also be a time, binary object, boolean or an array. It cannot be an
object.
"""
@spec table_create(Q.t(), Q.reql_string(), Q.reql_opts()) :: Q.t()
operate_on_single_arg(:table_create, 60, opts: true)
operate_on_two_args(:table_create, 60, opts: true)
@doc """
Drop a table. The table and all its data will be deleted.
If successful, the command returns an object with two fields:
* tables_dropped: always 1.
* config_changes: a list containing one two-field object, old_val and new_val:
* old_val: the dropped table’s config value.
* new_val: always nil.
If the given table does not exist in the database, the command throws RqlRuntimeError.
"""
@spec table_drop(Q.t(), Q.reql_string()) :: Q.t()
operate_on_single_arg(:table_drop, 61)
operate_on_two_args(:table_drop, 61)
@doc """
List all table names in a database. The result is a list of strings.
"""
@spec table_list(Q.t()) :: Q.t()
operate_on_zero_args(:table_list, 62)
operate_on_single_arg(:table_list, 62)
@doc """
Create a new secondary index on a table. Secondary indexes improve the speed of
many read queries at the slight cost of increased storage space and decreased
write performance. For more information about secondary indexes, read the
article “Using secondary indexes in RethinkDB.”
RethinkDB supports different types of secondary indexes:
* Simple indexes based on the value of a single field.
* Compound indexes based on multiple fields.
* Multi indexes based on arrays of values.
* Geospatial indexes based on indexes of geometry objects, created when the geo
optional argument is true.
* Indexes based on arbitrary expressions.
The index_function can be an anonymous function or a binary representation
obtained from the function field of index_status.
If successful, create_index will return an object of the form {:created => 1}.
If an index by that name already exists on the table, a RqlRuntimeError will be
thrown.
"""
@spec index_create(Q.t(), Q.reql_string(), Q.reql_func1(), Q.reql_opts()) :: Q.t()
operate_on_two_args(:index_create, 75, opts: true)
operate_on_three_args(:index_create, 75, opts: true)
@doc """
Delete a previously created secondary index of this table.
"""
@spec index_drop(Q.t(), Q.reql_string()) :: Q.t()
operate_on_two_args(:index_drop, 76)
@doc """
List all the secondary indexes of this table.
"""
@spec index_list(Q.t()) :: Q.t()
operate_on_single_arg(:index_list, 77)
@doc """
Rename an existing secondary index on a table. If the optional argument
overwrite is specified as true, a previously existing index with the new name
will be deleted and the index will be renamed. If overwrite is false (the
default) an error will be raised if the new index name already exists.
The return value on success will be an object of the format {:renamed => 1}, or
{:renamed => 0} if the old and new names are the same.
An error will be raised if the old index name does not exist, if the new index
name is already in use and overwrite is false, or if either the old or new
index name are the same as the primary key field name.
"""
@spec index_rename(Q.t(), Q.reql_string(), Q.reql_string(), Q.reql_opts()) :: Q.t()
operate_on_three_args(:index_rename, 156, opts: true)
@doc """
Get the status of the specified indexes on this table, or the status of all
indexes on this table if no indexes are specified.
"""
@spec index_status(Q.t(), Q.reql_string() | Q.reql_array()) :: Q.t()
operate_on_single_arg(:index_status, 139)
operate_on_seq_and_list(:index_status, 139)
operate_on_two_args(:index_status, 139)
@doc """
Wait for the specified indexes on this table to be ready, or for all indexes on
this table to be ready if no indexes are specified.
"""
@spec index_wait(Q.t(), Q.reql_string() | Q.reql_array()) :: Q.t()
operate_on_single_arg(:index_wait, 140)
operate_on_seq_and_list(:index_wait, 140)
operate_on_two_args(:index_wait, 140)
#
# Writing Data Queries
#
@doc """
Insert documents into a table. Accepts a single document or an array of
documents.
The optional arguments are:
* durability: possible values are hard and soft. This option will override the
table or query’s durability setting (set in run). In soft durability mode
Rethink_dB will acknowledge the write immediately after receiving and caching
it, but before the write has been committed to disk.
* return_changes: if set to True, return a changes array consisting of
old_val/new_val objects describing the changes made.
* conflict: Determine handling of inserting documents with the same primary key
as existing entries. Possible values are "error", "replace" or "update".
* "error": Do not insert the new document and record the conflict as an error.
This is the default.
* "replace": Replace the old document in its entirety with the new one.
* "update": Update fields of the old document with fields from the new one.
* `lambda(id, old_doc, new_doc) :: resolved_doc`: a function that receives the
id, old and new documents as arguments and returns a document which will be
inserted in place of the conflicted one.
Insert returns an object that contains the following attributes:
* inserted: the number of documents successfully inserted.
* replaced: the number of documents updated when conflict is set to "replace" or
"update".
* unchanged: the number of documents whose fields are identical to existing
documents with the same primary key when conflict is set to "replace" or
"update".
* errors: the number of errors encountered while performing the insert.
* first_error: If errors were encountered, contains the text of the first error.
* deleted and skipped: 0 for an insert operation.
* generated_keys: a list of generated primary keys for inserted documents whose
primary keys were not specified (capped to 100,000).
* warnings: if the field generated_keys is truncated, you will get the warning
“Too many generated keys (<X>), array truncated to 100000.”.
* changes: if return_changes is set to True, this will be an array of objects,
one for each objected affected by the insert operation. Each object will have
* two keys: {"new_val": <new value>, "old_val": None}.
"""
@spec insert(Q.t(), Q.reql_obj() | Q.reql_array(), Keyword.t()) :: Q.t()
operate_on_two_args(:insert, 56, opts: true)
@doc """
Update JSON documents in a table. Accepts a JSON document, a ReQL expression,
or a combination of the two.
The optional arguments are:
* durability: possible values are hard and soft. This option will override the
table or query’s durability setting (set in run). In soft durability mode
RethinkDB will acknowledge the write immediately after receiving it, but before
the write has been committed to disk.
* return_changes: if set to True, return a changes array consisting of
old_val/new_val objects describing the changes made.
* non_atomic: if set to True, executes the update and distributes the result to
replicas in a non-atomic fashion. This flag is required to perform
non-deterministic updates, such as those that require reading data from another
table.
Update returns an object that contains the following attributes:
* replaced: the number of documents that were updated.
* unchanged: the number of documents that would have been modified except the new
value was the same as the old value.
* skipped: the number of documents that were skipped because the document didn’t
exist.
* errors: the number of errors encountered while performing the update.
* first_error: If errors were encountered, contains the text of the first error.
* deleted and inserted: 0 for an update operation.
* changes: if return_changes is set to True, this will be an array of objects,
one for each objected affected by the update operation. Each object will have
* two keys: {"new_val": <new value>, "old_val": <old value>}.
"""
@spec update(Q.t(), Q.reql_obj(), Keyword.t()) :: Q.t()
operate_on_two_args(:update, 53, opts: true)
@doc """
Replace documents in a table. Accepts a JSON document or a ReQL expression, and
replaces the original document with the new one. The new document must have the
same primary key as the original document.
The optional arguments are:
* durability: possible values are hard and soft. This option will override the
table or query’s durability setting (set in run).
In soft durability mode RethinkDB will acknowledge the write immediately after
receiving it, but before the write has been committed to disk.
* return_changes: if set to True, return a changes array consisting of
old_val/new_val objects describing the changes made.
* non_atomic: if set to True, executes the replacement and distributes the result
to replicas in a non-atomic fashion. This flag is required to perform
non-deterministic updates, such as those that require reading data from another
table.
Replace returns an object that contains the following attributes:
* replaced: the number of documents that were replaced
* unchanged: the number of documents that would have been modified, except that
the new value was the same as the old value
* inserted: the number of new documents added. You can have new documents
inserted if you do a point-replace on a key that isn’t in the table or you do a
replace on a selection and one of the documents you are replacing has been
deleted
* deleted: the number of deleted documents when doing a replace with None
* errors: the number of errors encountered while performing the replace.
* first_error: If errors were encountered, contains the text of the first error.
* skipped: 0 for a replace operation
* changes: if return_changes is set to True, this will be an array of objects,
one for each objected affected by the replace operation. Each object will have
* two keys: {"new_val": <new value>, "old_val": <old value>}.
"""
@spec replace(Q.t(), Q.reql_obj(), Keyword.t()) :: Q.t()
operate_on_two_args(:replace, 55, opts: true)
@doc """
Delete one or more documents from a table.
The optional arguments are:
* durability: possible values are hard and soft. This option will override the
table or query’s durability setting (set in run).
In soft durability mode RethinkDB will acknowledge the write immediately after
receiving it, but before the write has been committed to disk.
* return_changes: if set to True, return a changes array consisting of
old_val/new_val objects describing the changes made.
Delete returns an object that contains the following attributes:
* deleted: the number of documents that were deleted.
* skipped: the number of documents that were skipped.
For example, if you attempt to delete a batch of documents, and another
concurrent query deletes some of those documents first, they will be counted as
skipped.
* errors: the number of errors encountered while performing the delete.
* first_error: If errors were encountered, contains the text of the first error.
inserted, replaced, and unchanged: all 0 for a delete operation.
* changes: if return_changes is set to True, this will be an array of objects,
one for each objected affected by the delete operation. Each object will have
* two keys: {"new_val": None, "old_val": <old value>}.
"""
@spec delete(Q.t()) :: Q.t()
operate_on_single_arg(:delete, 54, opts: true)
@doc """
sync ensures that writes on a given table are written to permanent storage.
Queries that specify soft durability (durability='soft') do not give such
guarantees, so sync can be used to ensure the state of these queries. A call to
sync does not return until all previous writes to the table are persisted.
If successful, the operation returns an object: {"synced": 1}.
"""
@spec sync(Q.t()) :: Q.t()
operate_on_single_arg(:sync, 138)
#
# Date and Time Queries
#
@doc """
Return a time object representing the current time in UTC. The command now() is
computed once when the server receives the query, so multiple instances of
r.now() will always return the same time inside a query.
"""
@spec now() :: Q.t()
operate_on_zero_args(:now, 103)
@doc """
Create a time object for a specific time.
A few restrictions exist on the arguments:
* year is an integer between 1400 and 9,999.
* month is an integer between 1 and 12.
* day is an integer between 1 and 31.
* hour is an integer.
* minutes is an integer.
* seconds is a double. Its value will be rounded to three decimal places
(millisecond-precision).
* timezone can be 'Z' (for UTC) or a string with the format ±[hh]:[mm].
"""
@spec time(reql_number, reql_number, reql_number, reql_string) :: Q.t()
def time(year, month, day, timezone), do: %Q{query: [136, [year, month, day, timezone]]}
@spec time(
reql_number,
reql_number,
reql_number,
reql_number,
reql_number,
reql_number,
reql_string
) :: Q.t()
def time(year, month, day, hour, minute, second, timezone) do
%Q{query: [136, [year, month, day, hour, minute, second, timezone]]}
end
@doc """
Create a time object based on seconds since epoch. The first argument is a
double and will be rounded to three decimal places (millisecond-precision).
"""
@spec epoch_time(reql_number) :: Q.t()
operate_on_single_arg(:epoch_time, 101)
@doc """
Create a time object based on an ISO 8601 date-time string (e.g.
‘2013-01-01T01:01:01+00:00’). We support all valid ISO 8601 formats except for
week dates. If you pass an ISO 8601 date-time without a time zone, you must
specify the time zone with the default_timezone argument.
"""
@spec iso8601(reql_string) :: Q.t()
operate_on_single_arg(:iso8601, 99, opts: true)
@doc """
Return a new time object with a different timezone. While the time stays the
same, the results returned by methods such as hours() will change since they
take the timezone into account. The timezone argument has to be of the ISO 8601
format.
"""
@spec in_timezone(Q.reql_time(), Q.reql_string()) :: Q.t()
operate_on_two_args(:in_timezone, 104)
@doc """
Return the timezone of the time object.
"""
@spec timezone(Q.reql_time()) :: Q.t()
operate_on_single_arg(:timezone, 127)
@doc """
Return if a time is between two other times (by default, inclusive for the
start, exclusive for the end).
"""
@spec during(Q.reql_time(), Q.reql_time(), Q.reql_time()) :: Q.t()
operate_on_three_args(:during, 105, opts: true)
@doc """
Return a new time object only based on the day, month and year (ie. the same
day at 00:00).
"""
@spec date(Q.reql_time()) :: Q.t()
operate_on_single_arg(:date, 106)
@doc """
Return the number of seconds elapsed since the beginning of the day stored in
the time object.
"""
@spec time_of_day(Q.reql_time()) :: Q.t()
operate_on_single_arg(:time_of_day, 126)
@doc """
Return the year of a time object.
"""
@spec year(Q.reql_time()) :: Q.t()
operate_on_single_arg(:year, 128)
@doc """
Return the month of a time object as a number between 1 and 12.
"""
@spec month(Q.reql_time()) :: Q.t()
operate_on_single_arg(:month, 129)
@doc """
Return the day of a time object as a number between 1 and 31.
"""
@spec day(Q.reql_time()) :: Q.t()
operate_on_single_arg(:day, 130)
@doc """
Return the day of week of a time object as a number between 1 and 7 (following
ISO 8601 standard).
"""
@spec day_of_week(Q.reql_time()) :: Q.t()
operate_on_single_arg(:day_of_week, 131)
@doc """
Return the day of the year of a time object as a number between 1 and 366
(following ISO 8601 standard).
"""
@spec day_of_year(Q.reql_time()) :: Q.t()
operate_on_single_arg(:day_of_year, 132)
@doc """
Return the hour in a time object as a number between 0 and 23.
"""
@spec hours(Q.reql_time()) :: Q.t()
operate_on_single_arg(:hours, 133)
@doc """
Return the minute in a time object as a number between 0 and 59.
"""
@spec minutes(Q.reql_time()) :: Q.t()
operate_on_single_arg(:minutes, 134)
@doc """
Return the seconds in a time object as a number between 0 and 59.999 (double precision).
"""
@spec seconds(Q.reql_time()) :: Q.t()
operate_on_single_arg(:seconds, 135)
@doc """
Convert a time object to a string in ISO 8601 format.
"""
@spec to_iso8601(Q.reql_time()) :: Q.t()
operate_on_single_arg(:to_iso8601, 100)
@doc """
Convert a time object to its epoch time.
"""
@spec to_epoch_time(Q.reql_time()) :: Q.t()
operate_on_single_arg(:to_epoch_time, 102)
#
# Transformations Queries
#
@doc """
Transform each element of one or more sequences by applying a mapping function
to them. If map is run with two or more sequences, it will iterate for as many
items as there are in the shortest sequence.
Note that map can only be applied to sequences, not single values. If you wish
to apply a function to a single value/selection (including an array), use the
do command.
"""
@spec map(Q.reql_array(), Q.reql_func1()) :: Q.t()
operate_on_two_args(:map, 38)
@doc """
Plucks one or more attributes from a sequence of objects, filtering out any
objects in the sequence that do not have the specified fields. Functionally,
this is identical to has_fields followed by pluck on a sequence.
"""
@spec with_fields(Q.reql_array(), Q.reql_array()) :: Q.t()
operate_on_seq_and_list(:with_fields, 96)
@doc """
Concatenate one or more elements into a single sequence using a mapping function.
"""
@spec flat_map(Q.reql_array(), Q.reql_func1()) :: Q.t()
operate_on_two_args(:flat_map, 40)
operate_on_two_args(:concat_map, 40)
@doc """
Sort the sequence by document values of the given key(s). To specify the
ordering, wrap the attribute with either r.asc or r.desc (defaults to
ascending).
Sorting without an index requires the server to hold the sequence in memory,
and is limited to 100,000 documents (or the setting of the array_limit option
for run). Sorting with an index can be done on arbitrarily large tables, or
after a between command using the same index.
"""
@spec order_by(Q.reql_array(), Q.reql_datum()) :: Q.t()
# XXX this is clunky, revisit this sometime
operate_on_optional_second_arg(:order_by, 41)
@doc """
Skip a number of elements from the head of the sequence.
"""
@spec skip(Q.reql_array(), Q.reql_number()) :: Q.t()
operate_on_two_args(:skip, 70)
@doc """
End the sequence after the given number of elements.
"""
@spec limit(Q.reql_array(), Q.reql_number()) :: Q.t()
operate_on_two_args(:limit, 71)
@doc """
Return the elements of a sequence within the specified range.
"""
@spec slice(Q.reql_array(), Q.reql_number(), Q.reql_number()) :: Q.t()
operate_on_three_args(:slice, 30, opts: true)
@doc """
Get the nth element of a sequence, counting from zero. If the argument is
negative, count from the last element.
"""
@spec nth(Q.reql_array(), Q.reql_number()) :: Q.t()
operate_on_two_args(:nth, 45)
@doc """
Get the indexes of an element in a sequence. If the argument is a predicate,
get the indexes of all elements matching it.
"""
@spec offsets_of(Q.reql_array(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:offsets_of, 87)
@doc """
Test if a sequence is empty.
"""
@spec is_empty(Q.reql_array()) :: Q.t()
operate_on_single_arg(:is_empty, 86)
@doc """
Concatenate two or more sequences.
"""
@spec union(Q.reql_array(), Q.reql_array()) :: Q.t()
operate_on_two_args(:union, 44)
@doc """
Select a given number of elements from a sequence with uniform random
distribution. Selection is done without replacement.
If the sequence has less than the requested number of elements (i.e., calling
sample(10) on a sequence with only five elements), sample will return the
entire sequence in a random order.
"""
@spec sample(Q.reql_array(), Q.reql_number()) :: Q.t()
operate_on_two_args(:sample, 81)
#
# Document Manipulation Queries
#
@doc """
Plucks out one or more attributes from either an object or a sequence of
objects (projection).
"""
@spec pluck(Q.reql_array(), Q.reql_array() | Q.reql_string()) :: Q.t()
operate_on_two_args(:pluck, 33)
@doc """
The opposite of pluck; takes an object or a sequence of objects, and returns
them with the specified paths removed.
"""
@spec without(Q.reql_array(), Q.reql_array() | Q.reql_string()) :: Q.t()
operate_on_two_args(:without, 34)
@doc """
Merge two or more objects together to construct a new object with properties
from all. When there is a conflict between field names, preference is given to
fields in the rightmost object in the argument list.
"""
@spec merge(Q.reql_array(), Q.reql_object() | Q.reql_func1()) :: Q.t()
operate_on_two_args(:merge, 35)
operate_on_list(:merge, 35)
operate_on_single_arg(:merge, 35)
@doc """
Append a value to an array.
"""
@spec append(Q.reql_array(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:append, 29)
@doc """
Prepend a value to an array.
"""
@spec prepend(Q.reql_array(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:prepend, 80)
@doc """
Remove the elements of one array from another array.
"""
@spec difference(Q.reql_array(), Q.reql_array()) :: Q.t()
operate_on_two_args(:difference, 95)
@doc """
Add a value to an array and return it as a set (an array with distinct values).
"""
@spec set_insert(Q.reql_array(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:set_insert, 88)
@doc """
Intersect two arrays returning values that occur in both of them as a set (an
array with distinct values).
"""
@spec set_intersection(Q.reql_array(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:set_intersection, 89)
@doc """
Add a several values to an array and return it as a set (an array with distinct
values).
"""
@spec set_union(Q.reql_array(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:set_union, 90)
@doc """
Remove the elements of one array from another and return them as a set (an
array with distinct values).
"""
@spec set_difference(Q.reql_array(), Q.reql_datum()) :: Q.t()
operate_on_two_args(:set_difference, 91)
@doc """
Get a single field from an object. If called on a sequence, gets that field
from every object in the sequence, skipping objects that lack it.
"""
@spec get_field(Q.reql_obj() | Q.reql_array(), Q.reql_string()) :: Q.t()
operate_on_two_args(:get_field, 31)
@doc """
Test if an object has one or more fields. An object has a field if it has
that key and the key has a non-null value. For instance, the object {'a':
1,'b': 2,'c': null} has the fields a and b.
"""
@spec has_fields(Q.reql_array(), Q.reql_array() | Q.reql_string()) :: Q.t()
operate_on_two_args(:has_fields, 32)
@doc """
Insert a value in to an array at a given index. Returns the modified array.
"""
@spec insert_at(Q.reql_array(), Q.reql_number(), Q.reql_datum()) :: Q.t()
operate_on_three_args(:insert_at, 82)
@doc """
Insert several values in to an array at a given index. Returns the modified array.
"""
@spec splice_at(Q.reql_array(), Q.reql_number(), Q.reql_datum()) :: Q.t()
operate_on_three_args(:splice_at, 85)
@doc """
Remove one or more elements from an array at a given index. Returns the modified array.
"""
@spec delete_at(Q.reql_array(), Q.reql_number(), Q.reql_number()) :: Q.t()
operate_on_two_args(:delete_at, 83)
operate_on_three_args(:delete_at, 83)
@doc """
Change a value in an array at a given index. Returns the modified array.
"""
@spec change_at(Q.reql_array(), Q.reql_number(), Q.reql_datum()) :: Q.t()
operate_on_three_args(:change_at, 84)
@doc """
Return an array containing all of the object’s keys.
"""
@spec keys(Q.reql_obj()) :: Q.t()
operate_on_single_arg(:keys, 94)
@doc """
Return an array containing all of the object’s values.
"""
@spec values(Q.reql_obj()) :: Q.t()
operate_on_single_arg(:values, 186)
@doc """
Replace an object in a field instead of merging it with an existing object in a
merge or update operation.
"""
@spec literal(Q.reql_object()) :: Q.t()
operate_on_single_arg(:literal, 137)
@doc """
Creates an object from a list of key-value pairs, where the keys must be
strings. r.object(A, B, C, D) is equivalent to r.expr([[A, B], [C,
D]]).coerce_to('OBJECT').
"""
@spec object(Q.reql_array()) :: Q.t()
operate_on_list(:object, 143)
#
# Administration
#
@spec config(Q.reql_term()) :: Q.t()
operate_on_single_arg(:config, 174)
@spec rebalance(Q.reql_term()) :: Q.t()
operate_on_single_arg(:rebalance, 179)
@spec reconfigure(Q.reql_term(), Q.reql_opts()) :: Q.t()
operate_on_single_arg(:reconfigure, 176, opts: true)
@spec status(Q.reql_term()) :: Q.t()
operate_on_single_arg(:status, 175)
@spec wait(Q.reql_term()) :: Q.t()
operate_on_single_arg(:wait, 177, opts: true)
#
# Miscellaneous functions
#
def make_array(array), do: %Q{query: [2, array]}
operate_on_single_arg(:changes, 152, opts: true)
def asc(key), do: %Q{query: [73, [key]]}
def desc(key), do: %Q{query: [74, [key]]}
def func(f) when is_function(f) do
{_, arity} = :erlang.fun_info(f, :arity)
args =
case arity do
0 -> []
_ -> Enum.map(1..arity, fn _ -> make_ref() end)
end
params = Enum.map(args, &var/1)
res =
case apply(f, params) do
x when is_list(x) -> make_array(x)
x -> x
end
%Q{query: [69, [[2, args], res]]}
end
def var(val), do: %Q{query: [10, [val]]}
def bracket(obj, key), do: %Q{query: [170, [obj, key]]}
operate_on_zero_args(:minval, 180)
operate_on_zero_args(:maxval, 181)
end
| 35.232449 | 149 | 0.690976 |
9e894463e8b1a631070c799c73a07b7f7aa95752 | 282 | exs | Elixir | test/ble_live_sample_web/views/layout_view_test.exs | khamada611/ble_live_sample | 058fa90048e5ef474f9185d370e7e3202e649041 | [
"Apache-2.0"
] | 4 | 2019-04-06T15:36:48.000Z | 2019-10-20T05:55:10.000Z | test/ble_live_sample_web/views/layout_view_test.exs | khamada611/ble_live_sample | 058fa90048e5ef474f9185d370e7e3202e649041 | [
"Apache-2.0"
] | null | null | null | test/ble_live_sample_web/views/layout_view_test.exs | khamada611/ble_live_sample | 058fa90048e5ef474f9185d370e7e3202e649041 | [
"Apache-2.0"
] | 1 | 2021-05-04T10:59:57.000Z | 2021-05-04T10:59:57.000Z | defmodule BleLiveSampleWeb.LayoutViewTest do
use BleLiveSampleWeb.ConnCase, async: true
# When testing helpers, you may want to import Phoenix.HTML and
# use functions such as safe_to_string() to convert the helper
# result into an HTML string.
# import Phoenix.HTML
end
| 31.333333 | 65 | 0.776596 |
9e895080dc010bdfb8f6751e823ee314fe3474d6 | 128 | exs | Elixir | test/flightex_test.exs | LuizFerK/Flightex | 35e1c0fc9472176f387be342b9a57a2dc98f88a2 | [
"MIT"
] | null | null | null | test/flightex_test.exs | LuizFerK/Flightex | 35e1c0fc9472176f387be342b9a57a2dc98f88a2 | [
"MIT"
] | null | null | null | test/flightex_test.exs | LuizFerK/Flightex | 35e1c0fc9472176f387be342b9a57a2dc98f88a2 | [
"MIT"
] | null | null | null | defmodule FlightexTest do
use ExUnit.Case
# test "greets the world" do
# assert Flightex.hello() == :world
# end
end
| 16 | 39 | 0.671875 |
9e895a5e3fec65f6619e605900ad8006f882de3c | 1,489 | ex | Elixir | apps/slacking/lib/slacking/bot_wrapper.ex | paulanthonywilson/morsey | b72d1eee54db1bcc8d0f2097c345da602995ce43 | [
"MIT"
] | 1 | 2018-12-30T04:37:15.000Z | 2018-12-30T04:37:15.000Z | apps/slacking/lib/slacking/bot_wrapper.ex | paulanthonywilson/morsey | b72d1eee54db1bcc8d0f2097c345da602995ce43 | [
"MIT"
] | null | null | null | apps/slacking/lib/slacking/bot_wrapper.ex | paulanthonywilson/morsey | b72d1eee54db1bcc8d0f2097c345da602995ce43 | [
"MIT"
] | null | null | null | defmodule Slacking.BotWrapper do
@moduledoc """
Wraps the Bot process, so that its pid is known.
Waits 1 second to start to prevent thrashing if we can not start.
"""
use GenServer
require Logger
import Slacking, only: [slack_channel: 0]
alias Slacking.BotHandler
@name __MODULE__
@connect_delay 1_000
defstruct bot_pid: nil
@type t :: %__MODULE__{bot_pid: pid()}
def start_link(_) do
GenServer.start_link(__MODULE__, {}, name: @name)
end
def init(_) do
Process.send_after(self(), :connect, @connect_delay)
{:ok, %__MODULE__{}}
end
@doc """
Send a message to the configured channel
"""
@spec send_slack_message(String.t()) :: :ok | {:error, String.t()}
def send_slack_message(message) do
GenServer.call(@name, {:send_slack_message, message})
end
def handle_info(:connect, s) do
case Slack.Bot.start_link(BotHandler, [], slack_token()) do
{:ok, pid} ->
{:noreply, %{s | bot_pid: pid}}
{:error, reason} ->
Logger.warn(fn -> "Could not connect to Slack: #{inspect(reason)}" end)
{:stop, :no_slack, s}
end
end
def handle_call(_, _from, s = %{bot_pid: nil}) do
{:reply, {:error, "Not connected to slack"}, s}
end
def handle_call({:send_slack_message, message}, _from, s = %{bot_pid: bot_pid}) do
send(bot_pid, {:send_slack_message, slack_channel(), message})
{:reply, :ok, s}
end
defp slack_token, do: Application.get_env(:slacking, :slack_token)
end
| 25.237288 | 84 | 0.655473 |
9e895d3f21bcd6aac8a459a45524244d8a571e21 | 865 | ex | Elixir | lib/nitro/routes.ex | enterprizing/iot | 1c8d71b2f779fabdad2a33b3ce3133ec2799eb9c | [
"0BSD"
] | 2 | 2019-07-27T13:29:35.000Z | 2019-07-28T08:56:46.000Z | lib/nitro/routes.ex | erpuno/iot | 1c8d71b2f779fabdad2a33b3ce3133ec2799eb9c | [
"0BSD"
] | 1 | 2019-07-29T22:37:22.000Z | 2019-07-29T22:37:22.000Z | lib/nitro/routes.ex | enterprizing/iot | 1c8d71b2f779fabdad2a33b3ce3133ec2799eb9c | [
"0BSD"
] | null | null | null | defmodule NITRO.Routes do
use N2O, with: [:n2o, :nitro]
def finish(state, context), do: {:ok, state, context}
def init(state, context) do
%{path: path} = cx(context, :req)
{:ok, state, cx(context, path: path, module: route_prefix(path))}
end
defp route_prefix(<<"/ws/", p::binary>>), do: route(p)
defp route_prefix(<<"/", p::binary>>), do: route(p)
defp route_prefix(path), do: route(path)
def route(<<"ldap", _::binary>>), do: LDAP.Index
def route(<<"kvs", _::binary>>), do: KVS.Index
def route(<<"iot", _::binary>>), do: IOT.Index
def route(<<"dev", _::binary>>), do: IOT.Device
def route(<<"app/ldap", _::binary>>), do: LDAP.Index
def route(<<"app/kvs", _::binary>>), do: KVS.Index
def route(<<"app/iot", _::binary>>), do: IOT.Index
def route(<<"app/dev", _::binary>>), do: IOT.Device
def route(_), do: LDAP.Index
end
| 34.6 | 69 | 0.609249 |
9e8961dcec3e10e13f2cf547a6506292769f524c | 2,517 | ex | Elixir | lib/platforms/old_danbooru.ex | vaartis/dev_random_ex | ee3210fdc5b1eabdc53097301c2915fa612ec311 | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2018-05-24T17:34:19.000Z | 2019-01-24T20:05:02.000Z | lib/platforms/old_danbooru.ex | vaartis/dev_random_ex | ee3210fdc5b1eabdc53097301c2915fa612ec311 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | lib/platforms/old_danbooru.ex | vaartis/dev_random_ex | ee3210fdc5b1eabdc53097301c2915fa612ec311 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | defmodule DevRandom.Platforms.OldDanbooru.PostAttachment do
@enforce_keys [:url, :type]
defstruct [:url, :type]
end
defimpl DevRandom.Platforms.Attachment, for: DevRandom.Platforms.OldDanbooru.PostAttachment do
def type(data), do: data.type
def phash(data) do
file_data = HTTPoison.get!(data.url).body
case data.type do
:photo -> {:phash, file_data |> PHash.image_binary_hash!()}
_ -> {:md5, :crypto.hash(:md5, file_data)}
end
end
def tg_file_string(data), do: {:url, data.url}
def vk_file_string(data), do: DevRandom.Platforms.VK.upload_photo_to_wall(data.type, data.url)
end
defmodule DevRandom.Platforms.OldDanbooru do
alias DevRandom.Platforms.Post
alias DevRandom.Platforms.OldDanbooru.PostAttachment
def post(base_url) do
import SweetXml
random_image =
ExternalService.call!(
__MODULE__.Fuse,
%ExternalService.RetryOptions{
backoff: {:exponential, 5_000},
rescue_only: [HTTPoison.Error]
},
fn ->
{total_images, ""} =
HTTPoison.get!("#{base_url}/index.php?page=dapi&s=post&q=index&limit=1", [],
timeout: 60_000
).body
|> xpath(~x"//posts/@count"l)
|> List.first()
|> to_string
|> Integer.parse()
pages = Integer.floor_div(total_images, 100)
random_page = Enum.random(1..pages)
HTTPoison.get!(
"#{base_url}/index.php?page=dapi&s=post&q=index&limit=100&json=1&pid=#{random_page}",
[],
timeout: 60_000
).body
|> Poison.decode!()
|> Enum.random()
end
)
type =
cond do
String.ends_with?(random_image["image"], ".gif") ->
:animation
String.ends_with?(random_image["image"], [".png", ".jpg", ".jpeg"]) ->
:photo
true ->
:other
end
url = "#{base_url}/images/#{random_image["directory"]}/#{random_image["image"]}"
%Post{
attachments: [
%PostAttachment{
type: type,
url: url
}
],
source_link: "#{base_url}/index.php?page=post&s=view&id=#{random_image["id"]}"
}
end
end
defmodule DevRandom.Platforms.OldDanbooru.Safebooru do
alias DevRandom.Platforms.OldDanbooru
@behaviour DevRandom.Platforms.PostSource
@base_url "https://safebooru.org"
@impl true
def post, do: OldDanbooru.post(@base_url)
@impl true
def cleanup(_data), do: :ok
end
| 25.424242 | 97 | 0.598729 |
9e89766bb47b257c1ce0537301dfa725672c5dba | 2,607 | ex | Elixir | apps/admin_panel/lib/admin_panel/application.ex | jimpeebles/ewallet | ad4a9750ec8dc5adc4c0dfe6c22f0ef760825405 | [
"Apache-2.0"
] | null | null | null | apps/admin_panel/lib/admin_panel/application.ex | jimpeebles/ewallet | ad4a9750ec8dc5adc4c0dfe6c22f0ef760825405 | [
"Apache-2.0"
] | null | null | null | apps/admin_panel/lib/admin_panel/application.ex | jimpeebles/ewallet | ad4a9750ec8dc5adc4c0dfe6c22f0ef760825405 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 OmiseGO Pte Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
defmodule AdminPanel.Application do
@moduledoc false
use Application
require Logger
alias AdminPanel.Endpoint
alias Phoenix.Endpoint.Watcher
alias Utils.Helpers.Normalize
import Supervisor.Spec
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
DeferredConfig.populate(:admin_panel)
# Always run AdminPanel.Endpoint as part of supervision tree
# regardless whether UrlDispatcher is enabled or not, since UrlDispatcher
# is not guarantee to be started, so we should not try to access the
# :url_dispatcher env here.
children = [supervisor(Endpoint, [])]
# Simply spawn a webpack process as part of supervision tree in case
# webpack_watch is enabled. It probably doesn't make sense to watch
# webpack without enabling endpoint serving, but we allow it anyway.
webpack_watch = Application.get_env(:admin_panel, :webpack_watch)
children =
children ++
case Normalize.to_boolean(webpack_watch) do
true ->
_ = Logger.info("Enabling webpack watcher.")
# Webpack watcher is only for development, and rely on assets path
# being present (which doesn't in production); so this is using
# __DIR__ to make it expand to source path rather than compiled path.
[
worker(
Watcher,
[:yarn, ["build"], [cd: Path.expand("../../assets/", __DIR__)]],
restart: :transient
)
]
_ ->
[]
end
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: AdminPanel.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
Endpoint.config_change(changed, removed)
:ok
end
end
| 35.22973 | 81 | 0.686613 |
9e8980c8af0b240d2e84d8f43d282fe65f22bea3 | 505 | ex | Elixir | lib/elixir_runtime/loop/client.ex | RTLS/aws-lambda-elixir-runtime | 0b7799ea680b36528db441c8c8094575fb7c5d39 | [
"MIT-0"
] | 3 | 2019-09-10T22:12:27.000Z | 2022-01-06T01:21:04.000Z | lib/elixir_runtime/loop/client.ex | Xerpa/aws-lambda-elixir-runtime | a673c0e934ce49aab9e1f3eea51218c29d3cafde | [
"MIT-0"
] | null | null | null | lib/elixir_runtime/loop/client.ex | Xerpa/aws-lambda-elixir-runtime | a673c0e934ce49aab9e1f3eea51218c29d3cafde | [
"MIT-0"
] | 2 | 2020-08-13T05:37:17.000Z | 2022-01-06T01:24:02.000Z | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
defmodule ElixirRuntime.Loop.Client do
@moduledoc "The Lambda Runtime Service Client behavior this runtime requires"
@type id :: String.t()
@type body :: String.t()
@type context :: Map.t()
@type invocation :: {id, body, context} | :no_invocation
@type response :: String.t()
@callback next_invocation() :: invocation
@callback complete_invocation(id, response) :: no_return
end
| 31.5625 | 79 | 0.722772 |
9e8980e652c97f3131b26a4ec7a9f6c2d1bd47f4 | 2,426 | ex | Elixir | lib/changelog_web/controllers/auth_controller.ex | gustavoarmoa/changelog.com | e898a9979a237ae66962714821ed8633a4966f37 | [
"MIT"
] | 2,599 | 2016-10-25T15:02:53.000Z | 2022-03-26T02:34:42.000Z | lib/changelog_web/controllers/auth_controller.ex | sdrees/changelog.com | 955cdcf93d74991062f19a03e34c9f083ade1705 | [
"MIT"
] | 253 | 2016-10-25T20:29:24.000Z | 2022-03-29T21:52:36.000Z | lib/changelog_web/controllers/auth_controller.ex | sdrees/changelog.com | 955cdcf93d74991062f19a03e34c9f083ade1705 | [
"MIT"
] | 298 | 2016-10-25T15:18:31.000Z | 2022-01-18T21:25:52.000Z | defmodule ChangelogWeb.AuthController do
use ChangelogWeb, :controller
alias Changelog.{Person, Mailer}
alias ChangelogWeb.Email
plug RequireGuest, "before signing in" when action in [:new, :create]
plug Ueberauth
def new(conn, %{"auth" => %{"email" => email}}) do
if person = Repo.get_by(Person, email: email) do
person = Person.refresh_auth_token(person)
Email.sign_in(person) |> Mailer.deliver_later()
render(conn, "new.html", person: person)
else
conn
|> put_flash(:success, "You aren't in our system! No worries, it's free to join. 💚")
|> redirect(to: Routes.person_path(conn, :join, %{email: email}))
end
end
def new(conn, _params) do
render(conn, "new.html", person: nil)
end
def create(conn, %{"token" => token}) do
person = Person.get_by_encoded_auth(token)
if person && Timex.before?(Timex.now(), person.auth_token_expires_at) do
sign_in_and_redirect(conn, person, Routes.home_path(conn, :show))
else
conn
|> put_flash(:error, "Whoops!")
|> render("new.html", person: nil)
end
end
def delete(conn, _params) do
conn
|> clear_session()
|> redirect(to: Routes.root_path(conn, :index))
end
def callback(conn = %{assigns: %{ueberauth_auth: auth}}, _params) do
if person = Person.get_by_ueberauth(auth) do
sign_in_and_redirect(conn, person, Routes.home_path(conn, :show))
else
conn
|> put_flash(:success, "Almost there! Please complete your profile now.")
|> redirect(to: Routes.person_path(conn, :join, params_from_ueberauth(auth)))
end
end
def callback(conn = %{assigns: %{ueberauth_failure: _fails}}, _params) do
conn
|> put_flash(:error, "Something went wrong. 😭")
|> render("new.html", person: nil)
end
defp params_from_ueberauth(%{provider: :github, info: info}) do
%{name: info.name, handle: info.nickname, github_handle: info.nickname}
end
defp params_from_ueberauth(%{provider: :twitter, info: info}) do
%{name: info.name, handle: info.nickname, twitter_handle: info.nickname}
end
defp sign_in_and_redirect(conn, person, route) do
person |> Person.sign_in_changes() |> Repo.update()
conn
|> assign(:current_user, person)
|> put_flash(:success, "Welcome to Changelog!")
|> put_session("id", person.id)
|> configure_session(renew: true)
|> redirect(to: route)
end
end
| 30.708861 | 90 | 0.664056 |
9e8983cbff41a254e4a54724a78769d1fc9fc68c | 26,186 | ex | Elixir | deps/jason/lib/decoder.ex | rpillar/Top5_Elixir | 9c450d2e9b291108ff1465dc066dfe442dbca822 | [
"MIT"
] | null | null | null | deps/jason/lib/decoder.ex | rpillar/Top5_Elixir | 9c450d2e9b291108ff1465dc066dfe442dbca822 | [
"MIT"
] | null | null | null | deps/jason/lib/decoder.ex | rpillar/Top5_Elixir | 9c450d2e9b291108ff1465dc066dfe442dbca822 | [
"MIT"
] | null | null | null | defmodule Jason.DecodeError do
@type t :: %__MODULE__{position: integer, data: String.t}
defexception [:position, :token, :data]
def message(%{position: position, token: token}) when is_binary(token) do
"unexpected sequence at position #{position}: #{inspect token}"
end
def message(%{position: position, data: data}) when position == byte_size(data) do
"unexpected end of input at position #{position}"
end
def message(%{position: position, data: data}) do
byte = :binary.at(data, position)
str = <<byte>>
if String.printable?(str) do
"unexpected byte at position #{position}: " <>
"#{inspect byte, base: :hex} ('#{str}')"
else
"unexpected byte at position #{position}: " <>
"#{inspect byte, base: :hex}"
end
end
end
defmodule Jason.Decoder do
@moduledoc false
import Bitwise
alias Jason.{DecodeError, Codegen}
import Codegen, only: [bytecase: 2, bytecase: 3]
# @compile :native
# We use integers instead of atoms to take advantage of the jump table
# optimization
@terminate 0
@array 1
@key 2
@object 3
def parse(data, opts) when is_binary(data) do
key_decode = key_decode_function(opts)
string_decode = string_decode_function(opts)
try do
value(data, data, 0, [@terminate], key_decode, string_decode)
catch
{:position, position} ->
{:error, %DecodeError{position: position, data: data}}
{:token, token, position} ->
{:error, %DecodeError{token: token, position: position, data: data}}
else
value ->
{:ok, value}
end
end
defp key_decode_function(%{keys: :atoms}), do: &String.to_atom/1
defp key_decode_function(%{keys: :atoms!}), do: &String.to_existing_atom/1
defp key_decode_function(%{keys: :strings}), do: &(&1)
defp key_decode_function(%{keys: fun}) when is_function(fun, 1), do: fun
defp string_decode_function(%{strings: :copy}), do: &:binary.copy/1
defp string_decode_function(%{strings: :reference}), do: &(&1)
defp value(data, original, skip, stack, key_decode, string_decode) do
bytecase data do
_ in '\s\n\t\r', rest ->
value(rest, original, skip + 1, stack, key_decode, string_decode)
_ in '0', rest ->
number_zero(rest, original, skip, stack, key_decode, string_decode, 1)
_ in '123456789', rest ->
number(rest, original, skip, stack, key_decode, string_decode, 1)
_ in '-', rest ->
number_minus(rest, original, skip, stack, key_decode, string_decode)
_ in '"', rest ->
string(rest, original, skip + 1, stack, key_decode, string_decode, 0)
_ in '[', rest ->
array(rest, original, skip + 1, stack, key_decode, string_decode)
_ in '{', rest ->
object(rest, original, skip + 1, stack, key_decode, string_decode)
_ in ']', rest ->
empty_array(rest, original, skip + 1, stack, key_decode, string_decode)
_ in 't', rest ->
case rest do
<<"rue", rest::bits>> ->
continue(rest, original, skip + 4, stack, key_decode, string_decode, true)
<<_::bits>> ->
error(original, skip)
end
_ in 'f', rest ->
case rest do
<<"alse", rest::bits>> ->
continue(rest, original, skip + 5, stack, key_decode, string_decode, false)
<<_::bits>> ->
error(original, skip)
end
_ in 'n', rest ->
case rest do
<<"ull", rest::bits>> ->
continue(rest, original, skip + 4, stack, key_decode, string_decode, nil)
<<_::bits>> ->
error(original, skip)
end
_, rest ->
error(rest, original, skip + 1, stack, key_decode, string_decode)
<<_::bits>> ->
error(original, skip)
end
end
defp number_minus(<<?0, rest::bits>>, original, skip, stack, key_decode, string_decode) do
number_zero(rest, original, skip, stack, key_decode, string_decode, 2)
end
defp number_minus(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode)
when byte in '123456789' do
number(rest, original, skip, stack, key_decode, string_decode, 2)
end
defp number_minus(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode) do
error(original, skip + 1)
end
defp number(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, len)
when byte in '0123456789' do
number(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number(<<?., rest::bits>>, original, skip, stack, key_decode, string_decode, len) do
number_frac(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number(<<e, rest::bits>>, original, skip, stack, key_decode, string_decode, len) when e in 'eE' do
prefix = binary_part(original, skip, len)
number_exp_copy(rest, original, skip + len + 1, stack, key_decode, string_decode, prefix)
end
defp number(<<rest::bits>>, original, skip, stack, key_decode, string_decode, len) do
int = String.to_integer(binary_part(original, skip, len))
continue(rest, original, skip + len, stack, key_decode, string_decode, int)
end
defp number_frac(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, len)
when byte in '0123456789' do
number_frac_cont(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number_frac(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode, len) do
error(original, skip + len)
end
defp number_frac_cont(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, len)
when byte in '0123456789' do
number_frac_cont(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number_frac_cont(<<e, rest::bits>>, original, skip, stack, key_decode, string_decode, len)
when e in 'eE' do
number_exp(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number_frac_cont(<<rest::bits>>, original, skip, stack, key_decode, string_decode, len) do
token = binary_part(original, skip, len)
float = try_parse_float(token, token, skip)
continue(rest, original, skip + len, stack, key_decode, string_decode, float)
end
defp number_exp(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, len)
when byte in '0123456789' do
number_exp_cont(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number_exp(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, len)
when byte in '+-' do
number_exp_sign(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number_exp(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode, len) do
error(original, skip + len)
end
defp number_exp_sign(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, len)
when byte in '0123456789' do
number_exp_cont(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number_exp_sign(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode, len) do
error(original, skip + len)
end
defp number_exp_cont(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, len)
when byte in '0123456789' do
number_exp_cont(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number_exp_cont(<<rest::bits>>, original, skip, stack, key_decode, string_decode, len) do
token = binary_part(original, skip, len)
float = try_parse_float(token, token, skip)
continue(rest, original, skip + len, stack, key_decode, string_decode, float)
end
defp number_exp_copy(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, prefix)
when byte in '0123456789' do
number_exp_cont(rest, original, skip, stack, key_decode, string_decode, prefix, 1)
end
defp number_exp_copy(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, prefix)
when byte in '+-' do
number_exp_sign(rest, original, skip, stack, key_decode, string_decode, prefix, 1)
end
defp number_exp_copy(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode, _prefix) do
error(original, skip)
end
defp number_exp_sign(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, prefix, len)
when byte in '0123456789' do
number_exp_cont(rest, original, skip, stack, key_decode, string_decode, prefix, len + 1)
end
defp number_exp_sign(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode, _prefix, len) do
error(original, skip + len)
end
defp number_exp_cont(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, prefix, len)
when byte in '0123456789' do
number_exp_cont(rest, original, skip, stack, key_decode, string_decode, prefix, len + 1)
end
defp number_exp_cont(<<rest::bits>>, original, skip, stack, key_decode, string_decode, prefix, len) do
suffix = binary_part(original, skip, len)
string = prefix <> ".0e" <> suffix
prefix_size = byte_size(prefix)
initial_skip = skip - prefix_size - 1
final_skip = skip + len
token = binary_part(original, initial_skip, prefix_size + len + 1)
float = try_parse_float(string, token, initial_skip)
continue(rest, original, final_skip, stack, key_decode, string_decode, float)
end
defp number_zero(<<?., rest::bits>>, original, skip, stack, key_decode, string_decode, len) do
number_frac(rest, original, skip, stack, key_decode, string_decode, len + 1)
end
defp number_zero(<<e, rest::bits>>, original, skip, stack, key_decode, string_decode, len) when e in 'eE' do
number_exp_copy(rest, original, skip + len + 1, stack, key_decode, string_decode, "0")
end
defp number_zero(<<rest::bits>>, original, skip, stack, key_decode, string_decode, len) do
continue(rest, original, skip + len, stack, key_decode, string_decode, 0)
end
@compile {:inline, array: 6}
defp array(rest, original, skip, stack, key_decode, string_decode) do
value(rest, original, skip, [@array, [] | stack], key_decode, string_decode)
end
defp empty_array(<<rest::bits>>, original, skip, stack, key_decode, string_decode) do
case stack do
[@array, [] | stack] ->
continue(rest, original, skip, stack, key_decode, string_decode, [])
_ ->
error(original, skip - 1)
end
end
defp array(data, original, skip, stack, key_decode, string_decode, value) do
bytecase data do
_ in '\s\n\t\r', rest ->
array(rest, original, skip + 1, stack, key_decode, string_decode, value)
_ in ']', rest ->
[acc | stack] = stack
value = :lists.reverse(acc, [value])
continue(rest, original, skip + 1, stack, key_decode, string_decode, value)
_ in ',', rest ->
[acc | stack] = stack
value(rest, original, skip + 1, [@array, [value | acc] | stack], key_decode, string_decode)
_, _rest ->
error(original, skip)
<<_::bits>> ->
empty_error(original, skip)
end
end
@compile {:inline, object: 6}
defp object(rest, original, skip, stack, key_decode, string_decode) do
key(rest, original, skip, [[] | stack], key_decode, string_decode)
end
defp object(data, original, skip, stack, key_decode, string_decode, value) do
bytecase data do
_ in '\s\n\t\r', rest ->
object(rest, original, skip + 1, stack, key_decode, string_decode, value)
_ in '}', rest ->
skip = skip + 1
[key, acc | stack] = stack
final = [{key_decode.(key), value} | acc]
continue(rest, original, skip, stack, key_decode, string_decode, :maps.from_list(final))
_ in ',', rest ->
skip = skip + 1
[key, acc | stack] = stack
acc = [{key_decode.(key), value} | acc]
key(rest, original, skip, [acc | stack], key_decode, string_decode)
_, _rest ->
error(original, skip)
<<_::bits>> ->
empty_error(original, skip)
end
end
defp key(data, original, skip, stack, key_decode, string_decode) do
bytecase data do
_ in '\s\n\t\r', rest ->
key(rest, original, skip + 1, stack, key_decode, string_decode)
_ in '}', rest ->
case stack do
[[] | stack] ->
continue(rest, original, skip + 1, stack, key_decode, string_decode, %{})
_ ->
error(original, skip)
end
_ in '"', rest ->
string(rest, original, skip + 1, [@key | stack], key_decode, string_decode, 0)
_, _rest ->
error(original, skip)
<<_::bits>> ->
empty_error(original, skip)
end
end
defp key(data, original, skip, stack, key_decode, string_decode, value) do
bytecase data do
_ in '\s\n\t\r', rest ->
key(rest, original, skip + 1, stack, key_decode, string_decode, value)
_ in ':', rest ->
value(rest, original, skip + 1, [@object, value | stack], key_decode, string_decode)
_, _rest ->
error(original, skip)
<<_::bits>> ->
empty_error(original, skip)
end
end
# TODO: check if this approach would be faster:
# https://git.ninenines.eu/cowlib.git/tree/src/cow_ws.erl#n469
# http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
defp string(data, original, skip, stack, key_decode, string_decode, len) do
bytecase data, 128 do
_ in '"', rest ->
string = string_decode.(binary_part(original, skip, len))
continue(rest, original, skip + len + 1, stack, key_decode, string_decode, string)
_ in '\\', rest ->
part = binary_part(original, skip, len)
escape(rest, original, skip + len, stack, key_decode, string_decode, part)
_ in unquote(0x00..0x1F), _rest ->
error(original, skip)
_, rest ->
string(rest, original, skip, stack, key_decode, string_decode, len + 1)
<<char::utf8, rest::bits>> when char <= 0x7FF ->
string(rest, original, skip, stack, key_decode, string_decode, len + 2)
<<char::utf8, rest::bits>> when char <= 0xFFFF ->
string(rest, original, skip, stack, key_decode, string_decode, len + 3)
<<_char::utf8, rest::bits>> ->
string(rest, original, skip, stack, key_decode, string_decode, len + 4)
<<_::bits>> ->
empty_error(original, skip + len)
end
end
defp string(data, original, skip, stack, key_decode, string_decode, acc, len) do
bytecase data, 128 do
_ in '"', rest ->
last = binary_part(original, skip, len)
string = IO.iodata_to_binary([acc | last])
continue(rest, original, skip + len + 1, stack, key_decode, string_decode, string)
_ in '\\', rest ->
part = binary_part(original, skip, len)
escape(rest, original, skip + len, stack, key_decode, string_decode, [acc | part])
_ in unquote(0x00..0x1F), _rest ->
error(original, skip)
_, rest ->
string(rest, original, skip, stack, key_decode, string_decode, acc, len + 1)
<<char::utf8, rest::bits>> when char <= 0x7FF ->
string(rest, original, skip, stack, key_decode, string_decode, acc, len + 2)
<<char::utf8, rest::bits>> when char <= 0xFFFF ->
string(rest, original, skip, stack, key_decode, string_decode, acc, len + 3)
<<_char::utf8, rest::bits>> ->
string(rest, original, skip, stack, key_decode, string_decode, acc, len + 4)
<<_::bits>> ->
empty_error(original, skip + len)
end
end
defp escape(data, original, skip, stack, key_decode, string_decode, acc) do
bytecase data do
_ in 'b', rest ->
string(rest, original, skip + 2, stack, key_decode, string_decode, [acc | '\b'], 0)
_ in 't', rest ->
string(rest, original, skip + 2, stack, key_decode, string_decode, [acc | '\t'], 0)
_ in 'n', rest ->
string(rest, original, skip + 2, stack, key_decode, string_decode, [acc | '\n'], 0)
_ in 'f', rest ->
string(rest, original, skip + 2, stack, key_decode, string_decode, [acc | '\f'], 0)
_ in 'r', rest ->
string(rest, original, skip + 2, stack, key_decode, string_decode, [acc | '\r'], 0)
_ in '"', rest ->
string(rest, original, skip + 2, stack, key_decode, string_decode, [acc | '\"'], 0)
_ in '/', rest ->
string(rest, original, skip + 2, stack, key_decode, string_decode, [acc | '/'], 0)
_ in '\\', rest ->
string(rest, original, skip + 2, stack, key_decode, string_decode, [acc | '\\'], 0)
_ in 'u', rest ->
escapeu(rest, original, skip, stack, key_decode, string_decode, acc)
_, _rest ->
error(original, skip + 1)
<<_::bits>> ->
empty_error(original, skip)
end
end
defmodule Unescape do
@moduledoc false
import Bitwise
@digits Enum.concat([?0..?9, ?A..?F, ?a..?f])
def unicode_escapes(chars1 \\ @digits, chars2 \\ @digits) do
for char1 <- chars1, char2 <- chars2 do
{(char1 <<< 8) + char2, integer8(char1, char2)}
end
end
defp integer8(char1, char2) do
(integer4(char1) <<< 4) + integer4(char2)
end
defp integer4(char) when char in ?0..?9, do: char - ?0
defp integer4(char) when char in ?A..?F, do: char - ?A + 10
defp integer4(char) when char in ?a..?f, do: char - ?a + 10
defp token_error_clause(original, skip, len) do
quote do
_ ->
token_error(unquote_splicing([original, skip, len]))
end
end
defmacro escapeu_first(int, last, rest, original, skip, stack, key_decode, string_decode, acc) do
clauses = escapeu_first_clauses(last, rest, original, skip, stack, key_decode, string_decode, acc)
quote location: :keep do
case unquote(int) do
unquote(clauses ++ token_error_clause(original, skip, 6))
end
end
end
defp escapeu_first_clauses(last, rest, original, skip, stack, key_decode, string_decode, acc) do
for {int, first} <- unicode_escapes(),
not (first in 0xDC..0xDF) do
escapeu_first_clause(int, first, last, rest, original, skip, stack, key_decode, string_decode, acc)
end
end
defp escapeu_first_clause(int, first, last, rest, original, skip, stack, key_decode, string_decode, acc)
when first in 0xD8..0xDB do
hi =
quote bind_quoted: [first: first, last: last] do
0x10000 + ((((first &&& 0x03) <<< 8) + last) <<< 10)
end
args = [rest, original, skip, stack, key_decode, string_decode, acc, hi]
[clause] =
quote location: :keep do
unquote(int) -> escape_surrogate(unquote_splicing(args))
end
clause
end
defp escapeu_first_clause(int, first, last, rest, original, skip, stack, key_decode, string_decode, acc)
when first <= 0x00 do
skip = quote do: (unquote(skip) + 6)
acc =
quote bind_quoted: [acc: acc, first: first, last: last] do
if last <= 0x7F do
# 0?????
[acc, last]
else
# 110xxxx?? 10?????
byte1 = ((0b110 <<< 5) + (first <<< 2)) + (last >>> 6)
byte2 = (0b10 <<< 6) + (last &&& 0b111111)
[acc, byte1, byte2]
end
end
args = [rest, original, skip, stack, key_decode, string_decode, acc, 0]
[clause] =
quote location: :keep do
unquote(int) -> string(unquote_splicing(args))
end
clause
end
defp escapeu_first_clause(int, first, last, rest, original, skip, stack, key_decode, string_decode, acc)
when first <= 0x07 do
skip = quote do: (unquote(skip) + 6)
acc =
quote bind_quoted: [acc: acc, first: first, last: last] do
# 110xxx?? 10??????
byte1 = ((0b110 <<< 5) + (first <<< 2)) + (last >>> 6)
byte2 = (0b10 <<< 6) + (last &&& 0b111111)
[acc, byte1, byte2]
end
args = [rest, original, skip, stack, key_decode, string_decode, acc, 0]
[clause] =
quote location: :keep do
unquote(int) -> string(unquote_splicing(args))
end
clause
end
defp escapeu_first_clause(int, first, last, rest, original, skip, stack, key_decode, string_decode, acc)
when first <= 0xFF do
skip = quote do: (unquote(skip) + 6)
acc =
quote bind_quoted: [acc: acc, first: first, last: last] do
# 1110xxxx 10xxxx?? 10??????
byte1 = (0b1110 <<< 4) + (first >>> 4)
byte2 = ((0b10 <<< 6) + ((first &&& 0b1111) <<< 2)) + (last >>> 6)
byte3 = (0b10 <<< 6) + (last &&& 0b111111)
[acc, byte1, byte2, byte3]
end
args = [rest, original, skip, stack, key_decode, string_decode, acc, 0]
[clause] =
quote location: :keep do
unquote(int) -> string(unquote_splicing(args))
end
clause
end
defmacro escapeu_last(int, original, skip) do
clauses = escapeu_last_clauses()
quote location: :keep do
case unquote(int) do
unquote(clauses ++ token_error_clause(original, skip, 6))
end
end
end
defp escapeu_last_clauses() do
for {int, last} <- unicode_escapes() do
[clause] =
quote do
unquote(int) -> unquote(last)
end
clause
end
end
defmacro escapeu_surrogate(int, last, rest, original, skip, stack, key_decode, string_decode, acc,
hi) do
clauses = escapeu_surrogate_clauses(last, rest, original, skip, stack, key_decode, string_decode, acc, hi)
quote location: :keep do
case unquote(int) do
unquote(clauses ++ token_error_clause(original, skip, 12))
end
end
end
defp escapeu_surrogate_clauses(last, rest, original, skip, stack, key_decode, string_decode, acc, hi) do
digits1 = 'Dd'
digits2 = Stream.concat([?C..?F, ?c..?f])
for {int, first} <- unicode_escapes(digits1, digits2) do
escapeu_surrogate_clause(int, first, last, rest, original, skip, stack, key_decode, string_decode, acc, hi)
end
end
defp escapeu_surrogate_clause(int, first, last, rest, original, skip, stack, key_decode, string_decode, acc, hi) do
skip = quote do: unquote(skip) + 12
acc =
quote bind_quoted: [acc: acc, first: first, last: last, hi: hi] do
lo = ((first &&& 0x03) <<< 8) + last
[acc | <<(hi + lo)::utf8>>]
end
args = [rest, original, skip, stack, key_decode, string_decode, acc, 0]
[clause] =
quote do
unquote(int) ->
string(unquote_splicing(args))
end
clause
end
end
defp escapeu(<<int1::16, int2::16, rest::bits>>, original, skip, stack, key_decode, string_decode, acc) do
require Unescape
last = escapeu_last(int2, original, skip)
Unescape.escapeu_first(int1, last, rest, original, skip, stack, key_decode, string_decode, acc)
end
defp escapeu(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode, _acc) do
empty_error(original, skip)
end
# @compile {:inline, escapeu_last: 3}
defp escapeu_last(int, original, skip) do
require Unescape
Unescape.escapeu_last(int, original, skip)
end
defp escape_surrogate(<<?\\, ?u, int1::16, int2::16, rest::bits>>, original,
skip, stack, key_decode, string_decode, acc, hi) do
require Unescape
last = escapeu_last(int2, original, skip + 6)
Unescape.escapeu_surrogate(int1, last, rest, original, skip, stack, key_decode, string_decode, acc, hi)
end
defp escape_surrogate(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode, _acc, _hi) do
error(original, skip + 6)
end
defp try_parse_float(string, token, skip) do
:erlang.binary_to_float(string)
catch
:error, :badarg ->
token_error(token, skip)
end
defp error(<<_rest::bits>>, _original, skip, _stack, _key_decode, _string_decode) do
throw {:position, skip - 1}
end
defp empty_error(_original, skip) do
throw {:position, skip}
end
@compile {:inline, error: 2, token_error: 2, token_error: 3}
defp error(_original, skip) do
throw {:position, skip}
end
defp token_error(token, position) do
throw {:token, token, position}
end
defp token_error(token, position, len) do
throw {:token, binary_part(token, position, len), position}
end
@compile {:inline, continue: 7}
defp continue(rest, original, skip, stack, key_decode, string_decode, value) do
case stack do
[@terminate | stack] ->
terminate(rest, original, skip, stack, key_decode, string_decode, value)
[@array | stack] ->
array(rest, original, skip, stack, key_decode, string_decode, value)
[@key | stack] ->
key(rest, original, skip, stack, key_decode, string_decode, value)
[@object | stack] ->
object(rest, original, skip, stack, key_decode, string_decode, value)
end
end
defp terminate(<<byte, rest::bits>>, original, skip, stack, key_decode, string_decode, value)
when byte in '\s\n\r\t' do
terminate(rest, original, skip + 1, stack, key_decode, string_decode, value)
end
defp terminate(<<>>, _original, _skip, _stack, _key_decode, _string_decode, value) do
value
end
defp terminate(<<_rest::bits>>, original, skip, _stack, _key_decode, _string_decode, _value) do
error(original, skip)
end
end
| 39.796353 | 120 | 0.610861 |
9e898d50eeca0b05e89976b3b8a873df153f2ce0 | 925 | ex | Elixir | lib/packets/handshake.ex | JayPeet/McQueryEx | 0beee833de53e2e8b1f41cc8af69124bb4a97edc | [
"MIT"
] | null | null | null | lib/packets/handshake.ex | JayPeet/McQueryEx | 0beee833de53e2e8b1f41cc8af69124bb4a97edc | [
"MIT"
] | null | null | null | lib/packets/handshake.ex | JayPeet/McQueryEx | 0beee833de53e2e8b1f41cc8af69124bb4a97edc | [
"MIT"
] | null | null | null | defmodule McQueryEx.Handshake do
@moduledoc """
McQueryEx.Handshake creates Handshake requests, and decodes Handshake responses. Used internally with each request.
"""
@type t :: <<_::56>>
@spec create(McQueryEx.t()) :: __MODULE__.t()
def create(%McQueryEx{session_id: id}) do
<<
McQueryEx.get_magic()::big-integer-16,
9::big-integer-8,
id::big-integer-32
#empty payload.
>>
end
@spec decode_response(binary()) :: {:ok, integer}
def decode_response(<<9::big-integer-8, _session_id::big-integer-32, challenge::binary>>) do
{parsed_challenge, _rem} = Integer.parse(challenge)
{:ok, parsed_challenge}
end
@spec decode_response(any()) :: {:error, String.t()}
def decode_response(_incorrect_response) do
{:error, "Handshake response was malformed."}
end
end | 34.259259 | 120 | 0.603243 |
9e89931aed584ec762284dbe1b05f680250bac7d | 450 | ex | Elixir | lab4/lib/lab4.ex | AlexandruBurlacu/NetworkProgrammingLabs | 289720c6bcf2ce4bcdb22b5f57ec03a2c1200891 | [
"MIT"
] | null | null | null | lab4/lib/lab4.ex | AlexandruBurlacu/NetworkProgrammingLabs | 289720c6bcf2ce4bcdb22b5f57ec03a2c1200891 | [
"MIT"
] | null | null | null | lab4/lib/lab4.ex | AlexandruBurlacu/NetworkProgrammingLabs | 289720c6bcf2ce4bcdb22b5f57ec03a2c1200891 | [
"MIT"
] | null | null | null | defmodule Lab4.Email do
import Bamboo.Email
@from "[email protected]"
def make_email(to \\ "[email protected]",
body \\ "Thanks for joining!") do
new_email(
to: to,
from: @from,
subject: "Welcome to the app.",
text_body: body
)
end
def send_email() do
Lab4.Email.make_email
|> Lab4.Mailer.deliver_now
end
end
| 21.428571 | 52 | 0.52 |
9e8a263797c91825dbae305d0a4d3111a3f41927 | 716 | ex | Elixir | examples/clock/lib/fake_utc_datetime.ex | hrzndhrn/time_zone_info | 18fa4e7aefd68d256202de8e0f96b69b8a9dc618 | [
"MIT"
] | 5 | 2020-04-05T16:03:03.000Z | 2022-02-07T22:11:04.000Z | examples/clock/lib/fake_utc_datetime.ex | hrzndhrn/time_zone_info | 18fa4e7aefd68d256202de8e0f96b69b8a9dc618 | [
"MIT"
] | 16 | 2020-03-28T17:46:13.000Z | 2021-08-25T08:35:48.000Z | examples/clock/lib/fake_utc_datetime.ex | hrzndhrn/time_zone_info | 18fa4e7aefd68d256202de8e0f96b69b8a9dc618 | [
"MIT"
] | null | null | null | defmodule FakeUtcDateTime do
@moduledoc false
use Agent
@behaviour TimeZoneInfo.UtcDateTime
def start_link(_) do
Agent.start_link(fn -> 0 end, name: __MODULE__)
end
@impl true
def now, do: now(:datetime)
@impl true
def now(:datetime) do
offset = case Process.whereis(__MODULE__) do
nil -> 0
_ ->
get_offset()
end
DateTime.utc_now() |> DateTime.add(offset)
end
def put(%DateTime{} = datetime) do
now = DateTime.utc_now |> DateTime.to_unix()
put_offset(DateTime.to_unix(datetime) - now)
end
defp put_offset(offset), do: Agent.update(__MODULE__, fn _ -> offset end)
defp get_offset, do: Agent.get(__MODULE__, fn offset -> offset end)
end
| 20.457143 | 75 | 0.668994 |
9e8a3f9407bbdbac8d3e600562c0d538732e3cda | 129 | ex | Elixir | lib/cbl2019/misc/math.ex | zoten/cbl2019 | 3a71b3ea68ef8e80d8ab51dfd52403b6c7849b62 | [
"BSD-3-Clause"
] | 1 | 2019-03-22T17:10:48.000Z | 2019-03-22T17:10:48.000Z | lib/cbl2019/misc/math.ex | zoten/cbl2019 | 3a71b3ea68ef8e80d8ab51dfd52403b6c7849b62 | [
"BSD-3-Clause"
] | null | null | null | lib/cbl2019/misc/math.ex | zoten/cbl2019 | 3a71b3ea68ef8e80d8ab51dfd52403b6c7849b62 | [
"BSD-3-Clause"
] | null | null | null | defmodule Cbl2019.Misc.Math do
@moduledoc """
Mini-module with math functions
"""
def increment(x) do
x + 1
end
end | 16.125 | 33 | 0.658915 |
9e8a9c175e7bed09102b2d62fb5ea0c3d8f6d409 | 8,338 | ex | Elixir | lib/pay_nl/transaction_options.ex | smeevil/pay_nl | 8b62ed5c01405aba432e56e8c2b6c5774da1470a | [
"WTFPL"
] | 3 | 2017-10-03T12:30:57.000Z | 2020-01-06T00:23:59.000Z | lib/pay_nl/transaction_options.ex | smeevil/pay_nl | 8b62ed5c01405aba432e56e8c2b6c5774da1470a | [
"WTFPL"
] | null | null | null | lib/pay_nl/transaction_options.ex | smeevil/pay_nl | 8b62ed5c01405aba432e56e8c2b6c5774da1470a | [
"WTFPL"
] | 1 | 2019-02-11T11:12:17.000Z | 2019-02-11T11:12:17.000Z | defmodule PayNL.TransactionOptions do
@moduledoc """
This module will validate and format all options that can be passed to pay.nl
"""
use Ecto.Schema
import Ecto.Changeset
@primary_key false
schema "options" do
field :amount_in_cents, :integer
field :api_token, :string
field :token_id, :string
field :currency, :string, default: "EUR"
field :notification_url, :string
field :remote_ip, :string
field :return_url, :string
field :service_id, :string
field :bank_account_holder, :string
field :bank_account_number, :string
field :custom_data, :string
field :description, :string
field :locale, :string, default: "EN"
field :payment_option_id, :integer
field :payment_provider, :string
field :reminder_email_template_id, :integer
field :send_reminder_email, :boolean, default: false
field :test, :boolean, default: false
end
@required_fields [:amount_in_cents, :api_token, :currency, :notification_url, :remote_ip, :return_url, :service_id, :token_id]
@optional_fields [
:custom_data,
:description,
:payment_option_id,
:payment_provider,
:reminder_email_template_id,
:send_reminder_email,
:test,
:locale
]
@field_mappings [
amount_in_cents: "amount",
return_url: "finishUrl",
remote_ip: "ipAddress",
service_id: "serviceId",
api_token: "token",
currency: "transaction[currency]",
description: "transaction[description]",
payment_option_id: "paymentOptionId",
custom_data: "statsData[extra1]",
notification_url: "transaction[orderExchangeUrl]",
test: "testMode",
description: "transaction[description]",
send_reminder_email: "transaction[sendReminderEmail]",
reminder_email_template_id: "transaction[reminderMailTemplateId]",
locale: "enduser[language]",
]
@payment_options %{
ideal: 10,
credit_card: 11,
paypal: 138,
mr_cash: 436
}
@doc """
Use this to create the PayNL.TransactionOptions struct which will validate all options given.
"""
@spec create(params :: map | list) :: {:ok, %PayNL.TransactionOptions{}} | {:error, list}
def create(params \\ %{})
def create(params) when is_list(params), do: create(Enum.into(params, %{}))
def create(params) do
case payment_changeset(%PayNL.TransactionOptions{}, params) do
%{valid?: true} = changeset -> {:ok, Ecto.Changeset.apply_changes(changeset)}
changeset -> {:error, Enum.map(changeset.errors, fn ({field, {msg, _}}) -> {field, msg} end)}
end
end
@doc """
Use this if you only need to validate / use credentials for your paynl account
"""
@spec credentials(params :: map | list) :: {:ok, %PayNL.TransactionOptions{}} | {:error, Ecto.Changeset.t}
def credentials(params \\ %{})
def credentials(params) when is_list(params), do: credentials(Enum.into(params, %{}))
def credentials(params) do
case credentials_changeset(params) do
%{valid?: true} = changeset -> {:ok, Ecto.Changeset.apply_changes(changeset)}
changeset -> {:error, Enum.map(changeset.errors, fn ({field, {msg, _}}) -> {field, msg} end)}
end
end
@spec credentials_changeset(params :: map) :: Ecto.Changeset.t
defp credentials_changeset(params) do
params = add_defaults(params)
%PayNL.TransactionOptions{}
|> cast(params, [:api_token, :service_id, :token_id])
|> validate_required(
:token_id,
message: ~s[has not been set, either pass it along with the params in this function as :token_id, alternatively you can pass it by defining an env var 'PAY_NL_TOKEN_ID=AT-xxxx-xxxx' or in you config add 'config :pay_nl, token_id: "AT-xxxx-xxxx"']
)
|> validate_required(
:api_token,
message: ~s[has not been set, either pass it along with the params in this function as :api_token, alternatively you can pass it by defining an env var 'PAY_NL_API_TOKEN=my_api_token' or in you config add 'config :pay_nl, api_token: "my_api_token"']
)
|> validate_required(
:service_id,
message: ~s[has not been set, either pass it along with the params in this function as :service_id, alternatively you can pass it by defining an env var 'PAY_NL_SERVICE_ID=my_service_id' or in you config add 'config :pay_nl, service_id: "my_service_id"']
)
end
@spec payment_changeset(struct :: %PayNL.TransactionOptions{}, params :: map) :: Ecto.Changeset.t
defp payment_changeset(struct, params) do
params = params
|> add_defaults
|> maybe_cast_payment_provider_to_string
struct
|> cast(params, @required_fields ++ @optional_fields)
|> validate_required(
:token_id,
message: ~s[has not been set, either pass it along with the params in this function as :token_id, alternatively you can pass it by defining an env var 'PAY_NL_TOKEN_ID=AT-xxxx-xxxx' or in you config add 'config :pay_nl, token_id: "AT-xxxx-xxxx"']
)
|> validate_required(
:api_token,
message: ~s[has not been set, either pass it along with the params in this function as :api_token, alternatively you can pass it by defining an env var 'PAY_NL_API_TOKEN=my_api_token' or in you config add 'config :pay_nl, api_token: "my_api_token"']
)
|> validate_required(
:service_id,
message: ~s[has not been set, either pass it along with the params in this function as :service_id, alternatively you can pass it by defining an env var 'PAY_NL_SERVICE_ID=my_service_id' or in you config add 'config :pay_nl, api_token: "my_service_id"']
)
|> validate_required(@required_fields)
|> validate_inclusion(
:payment_provider,
string_keys(@payment_options),
message: "should be one of #{
@payment_options
|> Map.keys()
|> Enum.join(", ")
}"
)
|> set_payment_provider_option
end
@spec add_defaults(params :: map) :: map
defp add_defaults(params) do
params
|> Map.put_new(:service_id, System.get_env("PAY_NL_SERVICE_ID") || Application.get_env(:pay_nl, :service_id))
|> Map.put_new(:api_token, System.get_env("PAY_NL_API_TOKEN") || Application.get_env(:pay_nl, :api_token))
|> Map.put_new(:token_id, System.get_env("PAY_NL_TOKEN_ID") || Application.get_env(:pay_nl, :token_id))
|> Map.put_new(:return_url, Application.get_env(:pay_nl, :return_url))
|> Map.put_new(:notification_url, Application.get_env(:pay_nl, :notification_url))
end
@spec set_payment_provider_option(changeset :: Ecto.Changeset.t) :: Ecto.Changeset.t
def set_payment_provider_option(
%{
valid?: true,
changes: %{
payment_provider: payment_provider
}
} = changeset
) do
Ecto.Changeset.put_change(changeset, :payment_option_id, @payment_options[String.to_atom(payment_provider)])
end
def set_payment_provider_option(changeset), do: changeset
@spec maybe_cast_payment_provider_to_string(params :: map) :: map
defp maybe_cast_payment_provider_to_string(%{payment_provider: payment_provider} = params)
when is_atom(payment_provider) do
Map.put(params, :payment_provider, Atom.to_string(payment_provider))
end
defp maybe_cast_payment_provider_to_string(params), do: params
@spec string_keys(map) :: list
defp string_keys(map), do: Enum.map(map, fn {k, _v} -> to_string(k) end)
@spec to_post_map(options :: %PayNL.TransactionOptions{}) :: map
def to_post_map(%PayNL.TransactionOptions{} = options) do
options
|> Map.from_struct
|> Map.delete(:__meta__)
|> process_options(@field_mappings)
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
end
@spec process_options(options :: map, mapping :: list({atom, binary}), data :: map) :: map
defp process_options(options, mapping, data \\ %{})
defp process_options(_options, [], data), do: data
defp process_options(options, [{key, mapped} | tail], data) do
data = case Map.get(options, key) do
nil -> data
value -> Map.put(data, mapped, convert_value(value))
end
process_options(options, tail, data)
end
@spec convert_value(value :: boolean | any) :: true | false | any
def convert_value(true), do: "1"
def convert_value(false), do: "0"
def convert_value(value), do: value
end
| 40.086538 | 263 | 0.685776 |
9e8a9cefde58b7a7735e2cdd4d5877c39fcfd9d9 | 6,507 | ex | Elixir | clients/big_query/lib/google_api/big_query/v2/model/routine.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2021-12-20T03:40:53.000Z | 2021-12-20T03:40:53.000Z | clients/big_query/lib/google_api/big_query/v2/model/routine.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2020-08-18T00:11:23.000Z | 2020-08-18T00:44:16.000Z | clients/big_query/lib/google_api/big_query/v2/model/routine.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.BigQuery.V2.Model.Routine do
@moduledoc """
A user-defined function or a stored procedure.
## Attributes
* `arguments` (*type:* `list(GoogleApi.BigQuery.V2.Model.Argument.t)`, *default:* `nil`) - Optional.
* `creationTime` (*type:* `String.t`, *default:* `nil`) - Output only. The time when this routine was created, in milliseconds since the epoch.
* `definitionBody` (*type:* `String.t`, *default:* `nil`) - Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\\n", y))` The definition_body is `concat(x, "\\n", y)` (\\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\\n";\\n'` The definition_body is `return "\\n";\\n` Note that both \\n are replaced with linebreaks.
* `description` (*type:* `String.t`, *default:* `nil`) - Optional. The description of the routine, if defined.
* `determinismLevel` (*type:* `String.t`, *default:* `nil`) - Optional. The determinism level of the JavaScript UDF, if defined.
* `etag` (*type:* `String.t`, *default:* `nil`) - Output only. A hash of this resource.
* `importedLibraries` (*type:* `list(String.t)`, *default:* `nil`) - Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.
* `language` (*type:* `String.t`, *default:* `nil`) - Optional. Defaults to "SQL".
* `lastModifiedTime` (*type:* `String.t`, *default:* `nil`) - Output only. The time when this routine was last modified, in milliseconds since the epoch.
* `returnTableType` (*type:* `GoogleApi.BigQuery.V2.Model.StandardSqlTableType.t`, *default:* `nil`) - Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
* `returnType` (*type:* `GoogleApi.BigQuery.V2.Model.StandardSqlDataType.t`, *default:* `nil`) - Optional if language = "SQL"; required otherwise. Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
* `routineReference` (*type:* `GoogleApi.BigQuery.V2.Model.RoutineReference.t`, *default:* `nil`) - Required. Reference describing the ID of this routine.
* `routineType` (*type:* `String.t`, *default:* `nil`) - Required. The type of routine.
* `strictMode` (*type:* `boolean()`, *default:* `nil`) - Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:arguments => list(GoogleApi.BigQuery.V2.Model.Argument.t()) | nil,
:creationTime => String.t() | nil,
:definitionBody => String.t() | nil,
:description => String.t() | nil,
:determinismLevel => String.t() | nil,
:etag => String.t() | nil,
:importedLibraries => list(String.t()) | nil,
:language => String.t() | nil,
:lastModifiedTime => String.t() | nil,
:returnTableType => GoogleApi.BigQuery.V2.Model.StandardSqlTableType.t() | nil,
:returnType => GoogleApi.BigQuery.V2.Model.StandardSqlDataType.t() | nil,
:routineReference => GoogleApi.BigQuery.V2.Model.RoutineReference.t() | nil,
:routineType => String.t() | nil,
:strictMode => boolean() | nil
}
field(:arguments, as: GoogleApi.BigQuery.V2.Model.Argument, type: :list)
field(:creationTime)
field(:definitionBody)
field(:description)
field(:determinismLevel)
field(:etag)
field(:importedLibraries, type: :list)
field(:language)
field(:lastModifiedTime)
field(:returnTableType, as: GoogleApi.BigQuery.V2.Model.StandardSqlTableType)
field(:returnType, as: GoogleApi.BigQuery.V2.Model.StandardSqlDataType)
field(:routineReference, as: GoogleApi.BigQuery.V2.Model.RoutineReference)
field(:routineType)
field(:strictMode)
end
defimpl Poison.Decoder, for: GoogleApi.BigQuery.V2.Model.Routine do
def decode(value, options) do
GoogleApi.BigQuery.V2.Model.Routine.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.BigQuery.V2.Model.Routine do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 75.662791 | 1,088 | 0.714461 |
9e8aabe50de2acf6fe4ae37c6afe2227243f7e12 | 716 | ex | Elixir | lib/perspective/storage/load_local_file.ex | backmath/perspective | a0a577d0ffb06805b64e4dcb171a093e051884b0 | [
"MIT"
] | 2 | 2020-04-24T19:43:06.000Z | 2020-04-24T19:52:27.000Z | lib/perspective/storage/load_local_file.ex | backmath/perspective | a0a577d0ffb06805b64e4dcb171a093e051884b0 | [
"MIT"
] | null | null | null | lib/perspective/storage/load_local_file.ex | backmath/perspective | a0a577d0ffb06805b64e4dcb171a093e051884b0 | [
"MIT"
] | null | null | null | defmodule Perspective.LoadLocalFile do
def load(file_path) do
try do
read_from_disk(file_path)
|> decrypt()
|> decompress()
rescue
File.Error -> {:error, Perspective.LocalFileNotFound.exception(file_path)}
end
end
def load!(file_path) do
case load(file_path) do
{:error, error} -> raise error
file -> file
end
end
defp read_from_disk(file_path) do
File.read!(file_path)
end
defp decrypt(data) do
try do
Perspective.Encryption.decrypt(data)
rescue
Perspective.NonDecryptableData -> data
end
end
defp decompress(data) do
try do
:zlib.gunzip(data)
rescue
ErlangError -> data
end
end
end
| 18.358974 | 80 | 0.639665 |
9e8ae24038e6861cb385b7b533941302d0fa930a | 1,476 | ex | Elixir | clients/real_time_bidding/lib/google_api/real_time_bidding/v1/model/empty.ex | yoshi-code-bot/elixir-google-api | cdb6032f01fac5ab704803113c39f2207e9e019d | [
"Apache-2.0"
] | null | null | null | clients/real_time_bidding/lib/google_api/real_time_bidding/v1/model/empty.ex | yoshi-code-bot/elixir-google-api | cdb6032f01fac5ab704803113c39f2207e9e019d | [
"Apache-2.0"
] | null | null | null | clients/real_time_bidding/lib/google_api/real_time_bidding/v1/model/empty.ex | yoshi-code-bot/elixir-google-api | cdb6032f01fac5ab704803113c39f2207e9e019d | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.RealTimeBidding.V1.Model.Empty do
@moduledoc """
A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
## Attributes
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{}
end
defimpl Poison.Decoder, for: GoogleApi.RealTimeBidding.V1.Model.Empty do
def decode(value, options) do
GoogleApi.RealTimeBidding.V1.Model.Empty.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.RealTimeBidding.V1.Model.Empty do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 35.142857 | 282 | 0.76084 |
9e8aedae59ee8c95fe364c987258aeac66048bc1 | 3,409 | exs | Elixir | test/mmdb2/result/city_test.exs | tcitworld/adapter_mmdb2 | 965fd00ce2ba3d11d1749047f97fa2ccaeaaf533 | [
"Apache-2.0"
] | 3 | 2018-03-03T18:59:55.000Z | 2020-12-31T19:36:59.000Z | test/mmdb2/result/city_test.exs | tcitworld/adapter_mmdb2 | 965fd00ce2ba3d11d1749047f97fa2ccaeaaf533 | [
"Apache-2.0"
] | 3 | 2019-07-17T12:55:41.000Z | 2020-08-31T18:55:15.000Z | test/mmdb2/result/city_test.exs | tcitworld/adapter_mmdb2 | 965fd00ce2ba3d11d1749047f97fa2ccaeaaf533 | [
"Apache-2.0"
] | 4 | 2019-07-15T10:07:16.000Z | 2021-09-22T15:46:04.000Z | defmodule Geolix.Adapter.MMDB2.Result.CityTest do
use ExUnit.Case, async: true
alias Geolix.Adapter.MMDB2.Record.Subdivision
alias Geolix.Adapter.MMDB2.Result.City
test "result type" do
result = Geolix.lookup("2.125.160.216", where: :fixture_city)
assert %City{} = result
assert %Subdivision{} = hd(result.subdivisions)
end
test "locale result" do
result = Geolix.lookup("2.125.160.216", locale: :fr, where: :fixture_city)
subdivision = hd(result.subdivisions)
assert result.continent.name == result.continent.names[:fr]
assert result.country.name == result.country.names[:fr]
assert result.registered_country.name == result.registered_country.names[:fr]
assert subdivision.name == subdivision.names[:fr]
end
test "locale result (default :en)" do
result = Geolix.lookup("2.125.160.216", where: :fixture_city)
assert result.continent.name == result.continent.names[:en]
assert result.country.name == result.country.names[:en]
end
test "ipv6 lookup" do
ip = "2001:298::"
{:ok, ip_address} = ip |> String.to_charlist() |> :inet.parse_address()
result = Geolix.lookup(ip, where: :fixture_city)
assert result.traits.ip_address == ip_address
assert "Asia" == result.continent.names[:en]
assert "Japan" == result.country.names[:en]
assert "Japan" == result.registered_country.names[:en]
assert "Asia/Tokyo" == result.location.time_zone
end
test "regular city" do
ip = {175, 16, 199, 0}
result = Geolix.lookup(ip, where: :fixture_city)
assert result.traits.ip_address == ip
assert "Chángchūn" == result.city.names[:de]
assert "Ásia" == result.continent.names[:"pt-BR"]
assert "China" == result.country.names[:es]
assert 100 == result.location.accuracy_radius
assert 43.88 == result.location.latitude
assert 125.3228 == result.location.longitude
assert "CN" == result.registered_country.iso_code
subdivision = hd(result.subdivisions)
assert "22" == subdivision.iso_code
assert "Jilin Sheng" == subdivision.names[:en]
end
test "represented country" do
ip = {202, 196, 224, 0}
result = Geolix.lookup(ip, where: :fixture_city)
assert result.traits.ip_address == ip
assert "Philippines" == result.country.names[:en]
assert "Philippines" == result.registered_country.names[:en]
assert "United States" == result.represented_country.names[:en]
assert "military" == result.represented_country.type
end
test "subdivisions: single" do
ip = {81, 2, 69, 144}
result = Geolix.lookup(ip, where: :fixture_city)
assert result.traits.ip_address == ip
assert "Londres" == result.city.names[:fr]
[sub] = result.subdivisions
assert 6_269_131 == sub.geoname_id
assert "ENG" == sub.iso_code
assert "Inglaterra" == sub.names[:"pt-BR"]
end
test "subdivisions: multiple" do
ip = {2, 125, 160, 216}
result = Geolix.lookup(ip, where: :fixture_city)
assert result.traits.ip_address == ip
assert "Boxford" == result.city.names[:en]
[sub_1, sub_2] = result.subdivisions
assert 6_269_131 == sub_1.geoname_id
assert 3_333_217 == sub_2.geoname_id
end
test "with traits" do
ip = {67, 43, 156, 0}
result = Geolix.lookup(ip, where: :fixture_city)
assert result.traits.ip_address == ip
assert result.traits.is_anonymous_proxy == true
end
end
| 28.889831 | 81 | 0.682312 |
9e8af044a2dc2e079cb00c101ba5f989f0b57be5 | 5,401 | ex | Elixir | lib/phoenix/router/scope.ex | G3z/phoenix | f13fe2c7f7ec25e6a59204266cb8cbbe7ffbbded | [
"MIT"
] | 2 | 2016-11-01T15:01:48.000Z | 2016-11-01T15:07:20.000Z | lib/phoenix/router/scope.ex | G3z/phoenix | f13fe2c7f7ec25e6a59204266cb8cbbe7ffbbded | [
"MIT"
] | null | null | null | lib/phoenix/router/scope.ex | G3z/phoenix | f13fe2c7f7ec25e6a59204266cb8cbbe7ffbbded | [
"MIT"
] | null | null | null | defmodule Phoenix.Router.Scope do
alias Phoenix.Router.{Scope, Route}
@moduledoc false
@stack :phoenix_router_scopes
@pipes :phoenix_pipeline_scopes
@top :phoenix_top_scopes
defstruct path: [], alias: [], as: [], pipes: [], host: nil, private: %{}, assigns: %{}
@doc """
Initializes the scope.
"""
def init(module) do
Module.put_attribute(module, @stack, [])
Module.put_attribute(module, @top, %Scope{})
Module.put_attribute(module, @pipes, MapSet.new)
end
@doc """
Builds a route based on the top of the stack.
"""
def route(line, module, kind, verb, path, plug, plug_opts, opts) do
path = validate_path(path)
private = Keyword.get(opts, :private, %{})
assigns = Keyword.get(opts, :assigns, %{})
as = Keyword.get(opts, :as, Phoenix.Naming.resource_name(plug, "Controller"))
alias? = Keyword.get(opts, :alias, true)
{path, host, alias, as, pipes, private, assigns} =
join(module, path, plug, alias?, as, private, assigns)
Phoenix.Router.Route.build(line, kind, verb, path, host, alias, plug_opts, as, pipes, private, assigns)
end
@doc """
Validates a path is a string and contains a leading prefix.
"""
def validate_path("/" <> _ = path), do: path
def validate_path(path) when is_binary(path) do
IO.warn """
router paths should begin with a forward slash, got: #{inspect path}
#{Exception.format_stacktrace}
"""
"/" <> path
end
def validate_path(path) do
raise ArgumentError, "router paths must be strings, got: #{inspect path}"
end
@doc """
Defines the given pipeline.
"""
def pipeline(module, pipe) when is_atom(pipe) do
update_pipes module, &MapSet.put(&1, pipe)
end
@doc """
Appends the given pipes to the current scope pipe through.
"""
def pipe_through(module, new_pipes) do
new_pipes = List.wrap(new_pipes)
%{pipes: pipes} = top = get_top(module)
if pipe = Enum.find(new_pipes, & &1 in pipes) do
raise ArgumentError,
"duplicate pipe_through for #{inspect pipe}. " <>
"A plug may only be used once inside a scoped pipe_through"
end
put_top(module, %{top | pipes: pipes ++ new_pipes})
end
@doc """
Pushes a scope into the module stack.
"""
def push(module, path) when is_binary(path) do
push(module, path: path)
end
def push(module, opts) when is_list(opts) do
path =
if path = Keyword.get(opts, :path) do
path |> validate_path() |> String.split("/", trim: true)
else
[]
end
alias = Keyword.get(opts, :alias) |> List.wrap() |> Enum.map(&Atom.to_string/1)
as = Keyword.get(opts, :as) |> List.wrap()
host = Keyword.get(opts, :host)
private = Keyword.get(opts, :private, %{})
assigns = Keyword.get(opts, :assigns, %{})
top = get_top(module)
update_stack(module, fn stack -> [top | stack] end)
put_top(module, %Scope{
path: top.path ++ path,
alias: top.alias ++ alias,
as: top.as ++ as,
host: host || top.host,
pipes: top.pipes,
private: Map.merge(top.private, private),
assigns: Map.merge(top.assigns, assigns)
})
end
@doc """
Pops a scope from the module stack.
"""
def pop(module) do
update_stack(module, fn [top | stack] ->
put_top(module, top)
stack
end)
end
@doc """
Add a forward to the router.
"""
def register_forwards(module, path, plug) when is_atom(plug) do
plug = expand_alias(module, plug)
phoenix_forwards = Module.get_attribute(module, :phoenix_forwards)
path_segments = Route.forward_path_segments(path, plug, phoenix_forwards)
phoenix_forwards = Map.put(phoenix_forwards, plug, path_segments)
Module.put_attribute(module, :phoenix_forwards, phoenix_forwards)
plug
end
def register_forwards(_, _, plug) do
raise ArgumentError, "forward expects a module as the second argument, #{inspect plug} given"
end
@doc """
Expands the alias in the current router scope.
"""
def expand_alias(module, alias) do
join_alias(get_top(module), alias)
end
defp join(module, path, alias, alias?, as, private, assigns) do
top = get_top(module)
joined_alias =
if alias? do
join_alias(top, alias)
else
alias
end
{join_path(top, path), top.host, joined_alias, join_as(top, as), top.pipes,
Map.merge(top.private, private), Map.merge(top.assigns, assigns)}
end
defp join_path(top, path) do
"/" <> Enum.join(top.path ++ String.split(path, "/", trim: true), "/")
end
defp join_alias(top, alias) when is_atom(alias) do
Module.concat(top.alias ++ [alias])
end
defp join_as(_top, nil), do: nil
defp join_as(top, as) when is_atom(as) or is_binary(as), do: Enum.join(top.as ++ [as], "_")
defp get_top(module) do
get_attribute(module, @top)
end
defp update_stack(module, fun) do
update_attribute(module, @stack, fun)
end
defp update_pipes(module, fun) do
update_attribute(module, @pipes, fun)
end
defp put_top(module, value) do
Module.put_attribute(module, @top, value)
value
end
defp get_attribute(module, attr) do
Module.get_attribute(module, attr) ||
raise "Phoenix router scope was not initialized"
end
defp update_attribute(module, attr, fun) do
Module.put_attribute(module, attr, fun.(get_attribute(module, attr)))
end
end
| 28.130208 | 107 | 0.648769 |
9e8b00940832a4a08614b13ba750fbba7ab1e1f1 | 687,743 | ex | Elixir | clients/health_care/lib/google_api/health_care/v1beta1/api/projects.ex | kyleVsteger/elixir-google-api | 3a0dd498af066a4361b5b0fd66ffc04a57539488 | [
"Apache-2.0"
] | null | null | null | clients/health_care/lib/google_api/health_care/v1beta1/api/projects.ex | kyleVsteger/elixir-google-api | 3a0dd498af066a4361b5b0fd66ffc04a57539488 | [
"Apache-2.0"
] | null | null | null | clients/health_care/lib/google_api/health_care/v1beta1/api/projects.ex | kyleVsteger/elixir-google-api | 3a0dd498af066a4361b5b0fd66ffc04a57539488 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.HealthCare.V1beta1.Api.Projects do
@moduledoc """
API calls for all endpoints tagged `Projects`.
"""
alias GoogleApi.HealthCare.V1beta1.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Gets information about a location.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Resource name for the location.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Location{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_get(
Tesla.Env.client(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Location.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_get(
connection,
projects_id,
locations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1beta1/projects/{projectsId}/locations/{locationsId}", %{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &(URI.char_unreserved?(&1) || &1 == ?/))
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Location{}])
end
@doc """
Lists information about the supported locations for this service.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource that owns the locations collection, if applicable.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - A filter to narrow down results to a preferred subset. The filtering language accepts strings like "displayName=tokyo", and is documented in more detail in [AIP-160](https://google.aip.dev/160).
* `:pageSize` (*type:* `integer()`) - The maximum number of results to return. If not set, the service selects a default.
* `:pageToken` (*type:* `String.t`) - A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListLocationsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListLocationsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_list(
connection,
projects_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1beta1/projects/{projectsId}/locations", %{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListLocationsResponse{}]
)
end
@doc """
Creates a new health dataset. Results are returned through the Operation interface which returns either an `Operation.response` which contains a Dataset or `Operation.error`. The metadata field type is OperationMetadata.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the project where the server creates the dataset. For example, `projects/{project_id}/locations/{location_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:datasetId` (*type:* `String.t`) - The ID of the dataset that is being created. The string must match the following regex: `[\\p{L}\\p{N}_\\-\\.]{1,256}`.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Dataset.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_create(
Tesla.Env.client(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_create(
connection,
projects_id,
locations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:datasetId => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets", %{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Creates a new dataset containing de-identified data from the source dataset. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifySummary. The LRO result may still be successful if de-identification fails for some resources. The new de-identified dataset will not contain these failed resources. The number of resources processed are tracked in Operation.metadata. Error details are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `sourceDataset`. Source dataset resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
* `locations_id` (*type:* `String.t`) - Part of `sourceDataset`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `sourceDataset`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.DeidentifyDatasetRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_deidentify(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_deidentify(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}:deidentify",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Deletes the specified health dataset and all data contained in the dataset. Deleting a dataset does not affect the sources from which the dataset was imported (if any).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the dataset to delete. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_delete(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Gets any metadata associated with a dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the dataset to read. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Dataset{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Dataset.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_get(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Dataset{}])
end
@doc """
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:"options.requestedPolicyVersion"` (*type:* `integer()`) - Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_get_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_get_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:"options.requestedPolicyVersion" => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}:getIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Lists the health datasets in the current project.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the project whose datasets should be listed. For example, `projects/{project_id}/locations/{location_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:pageSize` (*type:* `integer()`) - The maximum number of items to return. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - The next_page_token value returned from a previous List request, if any.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListDatasetsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_list(
Tesla.Env.client(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListDatasetsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_list(
connection,
projects_id,
locations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets", %{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListDatasetsResponse{}]
)
end
@doc """
Updates dataset metadata.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `dataset.name`. Resource name of the dataset, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
* `locations_id` (*type:* `String.t`) - Part of `dataset.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `dataset.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Dataset.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Dataset{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Dataset.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_patch(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Dataset{}])
end
@doc """
Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.SetIamPolicyRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_set_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_set_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}:setIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_test_iam_permissions(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_test_iam_permissions(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}:testIamPermissions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}]
)
end
@doc """
Creates a new Annotation store within the parent dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the dataset this Annotation store belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:annotationStoreId` (*type:* `String.t`) - The ID of the Annotation store that is being created. The string must match the following regex: `[\\p{L}\\p{N}_\\-\\.]{1,256}`.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.AnnotationStore.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.AnnotationStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.AnnotationStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_create(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:annotationStoreId => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.AnnotationStore{}])
end
@doc """
Deletes the specified Annotation store and removes all annotations that are contained within it.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the Annotation store to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_delete(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" =>
URI.encode(annotation_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Evaluate an Annotation store against a ground truth Annotation store. When the operation finishes successfully, a detailed response is returned of type EvaluateAnnotationStoreResponse, contained in the response. The metadata field type is OperationMetadata. Errors are logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The Annotation store to compare against `golden_store`, in the format of `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/annotationStores/{annotation_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.EvaluateAnnotationStoreRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_evaluate(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_evaluate(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}:evaluate",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Export Annotations from the Annotation store. If the request is successful, a detailed response is returned of type ExportAnnotationsResponse, contained in the response field when the operation finishes. The metadata field type is OperationMetadata. Errors are logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the Annotation store to export annotations to, in the format of `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/annotationStores/{annotation_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ExportAnnotationsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_export(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_export(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}:export",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Gets the specified Annotation store or returns NOT_FOUND if it does not exist.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the Annotation store to get.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.AnnotationStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.AnnotationStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_get(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" =>
URI.encode(annotation_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.AnnotationStore{}])
end
@doc """
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:"options.requestedPolicyVersion"` (*type:* `integer()`) - Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_get_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_get_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:"options.requestedPolicyVersion" => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}:getIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Import Annotations to the Annotation store by loading data from the specified sources. If the request is successful, a detailed response is returned as of type ImportAnnotationsResponse, contained in the response field when the operation finishes. The metadata field type is OperationMetadata. Errors are logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the Annotation store to which the server imports annotations, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/annotationStores/{annotation_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ImportAnnotationsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_import(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_import(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}:import",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Lists the Annotation stores in the given dataset for a source store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the dataset.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Restricts stores returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Only filtering on labels is supported, for example `labels.key=value`.
* `:pageSize` (*type:* `integer()`) - Limit on the number of Annotation stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - The next_page_token value returned from the previous List request, if any.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListAnnotationStoresResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListAnnotationStoresResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_list(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListAnnotationStoresResponse{}]
)
end
@doc """
Updates the specified Annotation store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `annotationStore.name`. Resource name of the Annotation store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/annotationStores/{annotation_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `annotationStore.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `annotationStore.name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `annotationStore.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.AnnotationStore.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.AnnotationStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.AnnotationStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_patch(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" =>
URI.encode(annotation_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.AnnotationStore{}])
end
@doc """
Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.SetIamPolicyRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_set_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_set_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}:setIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_test_iam_permissions(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_test_iam_permissions(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}:testIamPermissions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}]
)
end
@doc """
Creates a new Annotation record. It is valid to create Annotation objects for the same source more than once since a unique ID is assigned to each record by this service.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the Annotation store this annotation belongs to. For example, `projects/my-project/locations/us-central1/datasets/mydataset/annotationStores/myannotationstore`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Annotation.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Annotation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_annotations_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Annotation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_annotations_create(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}/annotations",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Annotation{}])
end
@doc """
Deletes an Annotation or returns NOT_FOUND if it does not exist.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the Annotation to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_annotations_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_annotations_delete(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
annotations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}/annotations/{annotationsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1),
"annotationsId" => URI.encode(annotations_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Gets an Annotation.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the Annotation to retrieve.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `annotations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Annotation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_annotations_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Annotation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_annotations_get(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
annotations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}/annotations/{annotationsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1),
"annotationsId" => URI.encode(annotations_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Annotation{}])
end
@doc """
Lists the Annotations in the given Annotation store for a source resource.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the Annotation store to retrieve Annotations from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Restricts Annotations returned to those matching a filter. Functions available for filtering are: - `matches("annotation_source.cloud_healthcare_source.name", substring)`. Filter on `cloud_healthcare_source.name`. For example: `matches("annotation_source.cloud_healthcare_source.name", "some source")`. - `matches("annotation", substring)`. Filter on all fields of annotation. For example: `matches("annotation", "some-content")`. - `type("text")`, `type("image")`, `type("resource")`. Filter on the type of annotation `data`.
* `:pageSize` (*type:* `integer()`) - Limit on the number of Annotations to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - The next_page_token value returned from the previous List request, if any.
* `:view` (*type:* `String.t`) - Controls which fields are populated in the response.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListAnnotationsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_annotations_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListAnnotationsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_annotations_list(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query,
:view => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}/annotations",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListAnnotationsResponse{}]
)
end
@doc """
Updates the Annotation.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `annotation.name`. Resource name of the Annotation, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/annotationStores/{annotation_store_id}/annotations/{annotation_id}`.
* `locations_id` (*type:* `String.t`) - Part of `annotation.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `annotation.name`. See documentation of `projectsId`.
* `annotation_stores_id` (*type:* `String.t`) - Part of `annotation.name`. See documentation of `projectsId`.
* `annotations_id` (*type:* `String.t`) - Part of `annotation.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Annotation.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Annotation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_annotation_stores_annotations_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Annotation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_annotation_stores_annotations_patch(
connection,
projects_id,
locations_id,
datasets_id,
annotation_stores_id,
annotations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/annotationStores/{annotationStoresId}/annotations/{annotationsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"annotationStoresId" => URI.encode(annotation_stores_id, &URI.char_unreserved?/1),
"annotationsId" => URI.encode(annotations_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Annotation{}])
end
@doc """
Checks if a particular data_id of a User data mapping in the specified consent store is consented for the specified use.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `consentStore`. Required. Name of the consent store where the requested data_id is stored, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.CheckDataAccessRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.CheckDataAccessResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_check_data_access(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.CheckDataAccessResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_check_data_access(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}:checkDataAccess",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.CheckDataAccessResponse{}]
)
end
@doc """
Creates a new consent store in the parent dataset. Attempting to create a consent store with the same ID as an existing store fails with an ALREADY_EXISTS error.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. The name of the dataset this consent store belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:consentStoreId` (*type:* `String.t`) - Required. The ID of the consent store to create. The string must match the following regex: `[\\p{L}\\p{N}_\\-\\.]{1,256}`. Cannot be changed after creation.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ConsentStore.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ConsentStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ConsentStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_create(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:consentStoreId => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ConsentStore{}])
end
@doc """
Deletes the specified consent store and removes all the consent store's data.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the consent store to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_delete(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" =>
URI.encode(consent_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Evaluates the user's Consents for all matching User data mappings. Note: User data mappings are indexed asynchronously, which can cause a slight delay between the time mappings are created or updated and when they are included in EvaluateUserConsents results.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `consentStore`. Required. Name of the consent store to retrieve User data mappings from.
* `locations_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.EvaluateUserConsentsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.EvaluateUserConsentsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_evaluate_user_consents(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.EvaluateUserConsentsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_evaluate_user_consents(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}:evaluateUserConsents",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.EvaluateUserConsentsResponse{}]
)
end
@doc """
Gets the specified consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the consent store to get.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ConsentStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ConsentStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_get(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" =>
URI.encode(consent_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ConsentStore{}])
end
@doc """
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:"options.requestedPolicyVersion"` (*type:* `integer()`) - Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_get_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_get_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:"options.requestedPolicyVersion" => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}:getIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Lists the consent stores in the specified dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. Name of the dataset.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Optional. Restricts the stores returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Only filtering on labels is supported. For example, `filter=labels.key=value`.
* `:pageSize` (*type:* `integer()`) - Optional. Limit on the number of consent stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - Optional. Token to retrieve the next page of results, or empty to get the first page.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListConsentStoresResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListConsentStoresResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_list(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListConsentStoresResponse{}]
)
end
@doc """
Updates the specified consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `consentStore.name`. Resource name of the consent store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`. Cannot be changed after creation.
* `locations_id` (*type:* `String.t`) - Part of `consentStore.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `consentStore.name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `consentStore.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - Required. The update mask that applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the `labels`, `default_consent_ttl`, and `enable_consent_create_on_update` fields are allowed to be updated.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ConsentStore.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ConsentStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ConsentStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_patch(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" =>
URI.encode(consent_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ConsentStore{}])
end
@doc """
Queries all data_ids that are consented for a specified use in the given consent store and writes them to a specified destination. The returned Operation includes a progress counter for the number of User data mappings processed. Errors are logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). For example, the following sample log entry shows a `failed to evaluate consent policy` error that occurred during a QueryAccessibleData call to consent store `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`. ```json jsonPayload: { @type: "type.googleapis.com/google.cloud.healthcare.logging.QueryAccessibleDataLogEntry" error: { code: 9 message: "failed to evaluate consent policy" } resourceName: "projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}" } logName: "projects/{project_id}/logs/healthcare.googleapis.com%2Fquery_accessible_data" operation: { id: "projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/operations/{operation_id}" producer: "healthcare.googleapis.com/QueryAccessibleData" } receiveTimestamp: "TIMESTAMP" resource: { labels: { consent_store_id: "{consent_store_id}" dataset_id: "{dataset_id}" location: "{location_id}" project_id: "{project_id}" } type: "healthcare_consent_store" } severity: "ERROR" timestamp: "TIMESTAMP" ```
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `consentStore`. Required. Name of the consent store to retrieve User data mappings from.
* `locations_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `consentStore`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.QueryAccessibleDataRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_query_accessible_data(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_query_accessible_data(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}:queryAccessibleData",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.SetIamPolicyRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_set_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_set_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}:setIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_test_iam_permissions(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_test_iam_permissions(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}:testIamPermissions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}]
)
end
@doc """
Creates a new Attribute definition in the parent consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. The name of the consent store that this Attribute definition belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:attributeDefinitionId` (*type:* `String.t`) - Required. The ID of the Attribute definition to create. The string must match the following regex: `_a-zA-Z{0,255}` and must not be a reserved keyword within the Common Expression Language as listed on https://github.com/google/cel-spec/blob/master/doc/langdef.md.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_attribute_definitions_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_attribute_definitions_create(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:attributeDefinitionId => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/attributeDefinitions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition{}]
)
end
@doc """
Deletes the specified Attribute definition. Fails if the Attribute definition is referenced by any User data mapping, or the latest revision of any Consent.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Attribute definition to delete. To preserve referential integrity, Attribute definitions referenced by a User data mapping or the latest revision of a Consent cannot be deleted.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `attribute_definitions_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_attribute_definitions_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_attribute_definitions_delete(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
attribute_definitions_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/attributeDefinitions/{attributeDefinitionsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"attributeDefinitionsId" =>
URI.encode(attribute_definitions_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Gets the specified Attribute definition.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Attribute definition to get.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `attribute_definitions_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_attribute_definitions_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_attribute_definitions_get(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
attribute_definitions_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/attributeDefinitions/{attributeDefinitionsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"attributeDefinitionsId" =>
URI.encode(attribute_definitions_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition{}]
)
end
@doc """
Lists the Attribute definitions in the specified consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. Name of the consent store to retrieve Attribute definitions from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Optional. Restricts the attributes returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The only field available for filtering is `category`. For example, `filter=category=\\"REQUEST\\"`.
* `:pageSize` (*type:* `integer()`) - Optional. Limit on the number of Attribute definitions to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - Optional. Token to retrieve the next page of results or empty to get the first page.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListAttributeDefinitionsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_attribute_definitions_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListAttributeDefinitionsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_attribute_definitions_list(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/attributeDefinitions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListAttributeDefinitionsResponse{}]
)
end
@doc """
Updates the specified Attribute definition.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `attributeDefinition.name`. Resource name of the Attribute definition, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/attributeDefinitions/{attribute_definition_id}`. Cannot be changed after creation.
* `locations_id` (*type:* `String.t`) - Part of `attributeDefinition.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `attributeDefinition.name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `attributeDefinition.name`. See documentation of `projectsId`.
* `attribute_definitions_id` (*type:* `String.t`) - Part of `attributeDefinition.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - Required. The update mask that applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the `description`, `allowed_values`, `consent_default_values` and `data_mapping_default_value` fields can be updated. The updated `allowed_values` must contain all values from the previous `allowed_values`.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_attribute_definitions_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_attribute_definitions_patch(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
attribute_definitions_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/attributeDefinitions/{attributeDefinitionsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"attributeDefinitionsId" =>
URI.encode(attribute_definitions_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.AttributeDefinition{}]
)
end
@doc """
Creates a new Consent artifact in the parent consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. The name of the consent store this Consent artifact belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ConsentArtifact.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ConsentArtifact{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consent_artifacts_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ConsentArtifact.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consent_artifacts_create(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consentArtifacts",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ConsentArtifact{}])
end
@doc """
Deletes the specified Consent artifact. Fails if the artifact is referenced by the latest revision of any Consent.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent artifact to delete. To preserve referential integrity, Consent artifacts referenced by the latest revision of a Consent cannot be deleted.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_artifacts_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consent_artifacts_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consent_artifacts_delete(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consent_artifacts_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consentArtifacts/{consentArtifactsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentArtifactsId" =>
URI.encode(consent_artifacts_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Gets the specified Consent artifact.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent artifact to retrieve.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_artifacts_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ConsentArtifact{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consent_artifacts_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ConsentArtifact.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consent_artifacts_get(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consent_artifacts_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consentArtifacts/{consentArtifactsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentArtifactsId" =>
URI.encode(consent_artifacts_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ConsentArtifact{}])
end
@doc """
Lists the Consent artifacts in the specified consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. Name of the consent store to retrieve consent artifacts from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Optional. Restricts the artifacts returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The fields available for filtering are: - user_id. For example, `filter=user_id=\\"user123\\"`. - consent_content_version - metadata. For example, `filter=Metadata(\\"testkey\\")=\\"value\\"` or `filter=HasMetadata(\\"testkey\\")`.
* `:pageSize` (*type:* `integer()`) - Optional. Limit on the number of consent artifacts to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - Optional. The next_page_token value returned from the previous List request, if any.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListConsentArtifactsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consent_artifacts_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListConsentArtifactsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consent_artifacts_list(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consentArtifacts",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListConsentArtifactsResponse{}]
)
end
@doc """
Activates the latest revision of the specified Consent by committing a new revision with `state` updated to `ACTIVE`. If the latest revision of the specified Consent is in the `ACTIVE` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the specified consent is in the `REJECTED` or `REVOKED` state.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent to activate, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consents_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ActivateConsentRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Consent{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_activate(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Consent.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_activate(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consents_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents/{consentsId}:activate",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentsId" => URI.encode(consents_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Consent{}])
end
@doc """
Creates a new Consent in the parent consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. Name of the consent store.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Consent.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Consent{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Consent.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_create(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Consent{}])
end
@doc """
Deletes the Consent and its revisions. To keep a record of the Consent but mark it inactive, see [RevokeConsent]. To delete a revision of a Consent, see [DeleteConsentRevision]. This operation does not delete the related Consent artifact.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent to delete, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consents_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_delete(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consents_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents/{consentsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentsId" => URI.encode(consents_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Deletes the specified revision of a Consent. An INVALID_ARGUMENT error occurs if the specified revision is the latest revision.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent revision to delete, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}@{revision_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is not specified in the name.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consents_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_delete_revision(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_delete_revision(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consents_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents/{consentsId}:deleteRevision",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentsId" => URI.encode(consents_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Gets the specified revision of a Consent, or the latest revision if `revision_id` is not specified in the resource name.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent to retrieve, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. In order to retrieve a previous revision of the Consent, also provide the revision ID: `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}@{revision_id}`
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consents_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Consent{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Consent.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_get(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consents_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents/{consentsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentsId" => URI.encode(consents_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Consent{}])
end
@doc """
Lists the Consent in the given consent store, returning each Consent's latest revision.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. Name of the consent store to retrieve Consents from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Optional. Restricts the consents returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The fields available for filtering are: - user_id. For example, `filter='user_id="user123"'`. - consent_artifact - state - revision_create_time - metadata. For example, `filter=Metadata(\\"testkey\\")=\\"value\\"` or `filter=HasMetadata(\\"testkey\\")`.
* `:pageSize` (*type:* `integer()`) - Optional. Limit on the number of Consents to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - Optional. The next_page_token value returned from the previous List request, if any.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListConsentsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListConsentsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_list(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListConsentsResponse{}]
)
end
@doc """
Lists the revisions of the specified Consent in reverse chronological order.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent to retrieve revisions for.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consents_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Optional. Restricts the revisions returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Fields/functions available for filtering are: - user_id. For example, `filter='user_id="user123"'`. - consent_artifact - state - revision_create_time - metadata. For example, `filter=Metadata(\\"testkey\\")=\\"value\\"` or `filter=HasMetadata(\\"testkey\\")`.
* `:pageSize` (*type:* `integer()`) - Optional. Limit on the number of revisions to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - Optional. Token to retrieve the next page of results or empty if there are no more results in the list.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListConsentRevisionsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_list_revisions(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListConsentRevisionsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_list_revisions(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consents_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents/{consentsId}:listRevisions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentsId" => URI.encode(consents_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListConsentRevisionsResponse{}]
)
end
@doc """
Updates the latest revision of the specified Consent by committing a new revision with the changes. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the `REJECTED` or `REVOKED` state.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `consent.name`. Resource name of the Consent, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. Cannot be changed after creation.
* `locations_id` (*type:* `String.t`) - Part of `consent.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `consent.name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `consent.name`. See documentation of `projectsId`.
* `consents_id` (*type:* `String.t`) - Part of `consent.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - Required. The update mask to apply to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the `user_id`, `policies`, `consent_artifact`, and `metadata` fields can be updated.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Consent.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Consent{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Consent.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_patch(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consents_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents/{consentsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentsId" => URI.encode(consents_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Consent{}])
end
@doc """
Rejects the latest revision of the specified Consent by committing a new revision with `state` updated to `REJECTED`. If the latest revision of the specified Consent is in the `REJECTED` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the `ACTIVE` or `REVOKED` state.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent to reject, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consents_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.RejectConsentRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Consent{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_reject(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Consent.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_reject(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consents_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents/{consentsId}:reject",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentsId" => URI.encode(consents_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Consent{}])
end
@doc """
Revokes the latest revision of the specified Consent by committing a new revision with `state` updated to `REVOKED`. If the latest revision of the specified Consent is in the `REVOKED` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the given consent is in `DRAFT` or `REJECTED` state.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the Consent to revoke, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consents_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.RevokeConsentRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Consent{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_consents_revoke(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Consent.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_consents_revoke(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
consents_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/consents/{consentsId}:revoke",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"consentsId" => URI.encode(consents_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Consent{}])
end
@doc """
Archives the specified User data mapping.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the User data mapping to archive.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `user_data_mappings_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ArchiveUserDataMappingRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ArchiveUserDataMappingResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_user_data_mappings_archive(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ArchiveUserDataMappingResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_user_data_mappings_archive(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
user_data_mappings_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/userDataMappings/{userDataMappingsId}:archive",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"userDataMappingsId" => URI.encode(user_data_mappings_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ArchiveUserDataMappingResponse{}]
)
end
@doc """
Creates a new User data mapping in the parent consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. Name of the consent store.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.UserDataMapping.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.UserDataMapping{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_user_data_mappings_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.UserDataMapping.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_user_data_mappings_create(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/userDataMappings",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.UserDataMapping{}])
end
@doc """
Deletes the specified User data mapping.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the User data mapping to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `user_data_mappings_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_user_data_mappings_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_user_data_mappings_delete(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
user_data_mappings_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/userDataMappings/{userDataMappingsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"userDataMappingsId" =>
URI.encode(user_data_mappings_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Gets the specified User data mapping.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Required. The resource name of the User data mapping to retrieve.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `user_data_mappings_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.UserDataMapping{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_user_data_mappings_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.UserDataMapping.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_user_data_mappings_get(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
user_data_mappings_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/userDataMappings/{userDataMappingsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"userDataMappingsId" =>
URI.encode(user_data_mappings_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.UserDataMapping{}])
end
@doc """
Lists the User data mappings in the specified consent store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Required. Name of the consent store to retrieve User data mappings from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Optional. Restricts the user data mappings returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The fields available for filtering are: - data_id - user_id. For example, `filter=user_id=\\"user123\\"`. - archived - archive_time
* `:pageSize` (*type:* `integer()`) - Optional. Limit on the number of User data mappings to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - Optional. Token to retrieve the next page of results, or empty to get the first page.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListUserDataMappingsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_user_data_mappings_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListUserDataMappingsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_user_data_mappings_list(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/userDataMappings",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListUserDataMappingsResponse{}]
)
end
@doc """
Updates the specified User data mapping.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `userDataMapping.name`. Resource name of the User data mapping, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/userDataMappings/{user_data_mapping_id}`.
* `locations_id` (*type:* `String.t`) - Part of `userDataMapping.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `userDataMapping.name`. See documentation of `projectsId`.
* `consent_stores_id` (*type:* `String.t`) - Part of `userDataMapping.name`. See documentation of `projectsId`.
* `user_data_mappings_id` (*type:* `String.t`) - Part of `userDataMapping.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - Required. The update mask that applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the `data_id`, `user_id` and `resource_attributes` fields can be updated.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.UserDataMapping.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.UserDataMapping{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_consent_stores_user_data_mappings_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.UserDataMapping.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_consent_stores_user_data_mappings_patch(
connection,
projects_id,
locations_id,
datasets_id,
consent_stores_id,
user_data_mappings_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/consentStores/{consentStoresId}/userDataMappings/{userDataMappingsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"consentStoresId" => URI.encode(consent_stores_id, &URI.char_unreserved?/1),
"userDataMappingsId" =>
URI.encode(user_data_mappings_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.UserDataMapping{}])
end
@doc """
Creates a new DICOM store within the parent dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the dataset this DICOM store belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:dicomStoreId` (*type:* `String.t`) - The ID of the DICOM store that is being created. Any string value up to 256 characters in length.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.DicomStore.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.DicomStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.DicomStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_create(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:dicomStoreId => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.DicomStore{}])
end
@doc """
De-identifies data from the source store and writes it to the destination store. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifyDicomStoreSummary. The LRO result may still be successful if de-identification fails for some DICOM instances. The output DICOM store will not contain these failed resources. The number of resources processed are tracked in Operation.metadata. Error details are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `sourceStore`. Source DICOM store resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `sourceStore`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `sourceStore`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `sourceStore`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.DeidentifyDicomStoreRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_deidentify(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_deidentify(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}:deidentify",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Deletes the specified DICOM store and removes all images that are contained within it.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the DICOM store to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_delete(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Exports data to the specified destination by copying it from the DICOM store. Errors are also logged to Cloud Logging. For more information, see [Viewing errors in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging). The metadata field type is OperationMetadata.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The DICOM store resource name from which to export the data. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ExportDicomDataRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_export(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_export(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}:export",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Gets the specified DICOM store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the DICOM store to get.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.DicomStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.DicomStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_get(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.DicomStore{}])
end
@doc """
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:"options.requestedPolicyVersion"` (*type:* `integer()`) - Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_get_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_get_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:"options.requestedPolicyVersion" => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}:getIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Imports data into the DICOM store by copying it from the specified source. Errors are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging). The metadata field type is OperationMetadata.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the DICOM store resource into which the data is imported. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ImportDicomDataRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_import(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_import(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}:import",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Lists the DICOM stores in the given dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the dataset.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Restricts stores returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Only filtering on labels is supported. For example, `labels.key=value`.
* `:pageSize` (*type:* `integer()`) - Limit on the number of DICOM stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - The next_page_token value returned from the previous List request, if any.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListDicomStoresResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListDicomStoresResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_list(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListDicomStoresResponse{}]
)
end
@doc """
Updates the specified DICOM store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `dicomStore.name`. Resource name of the DICOM store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `dicomStore.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `dicomStore.name`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `dicomStore.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.DicomStore.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.DicomStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.DicomStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_patch(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.DicomStore{}])
end
@doc """
SearchForInstances returns a list of matching instances. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Searching for studies, series, instances, and frames](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#searching_for_studies_series_instances_and_frames).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_search_for_instances(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_search_for_instances(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/instances",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
SearchForSeries returns a list of matching series. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of SearchForSeries, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForSeries, see [Searching for studies, series, instances, and frames](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#searching_for_studies_series_instances_and_frames).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_search_for_series(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_search_for_series(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/series",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
SearchForStudies returns a list of matching studies. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of SearchForStudies, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForStudies, see [Searching for studies, series, instances, and frames](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#searching_for_studies_series_instances_and_frames).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_search_for_studies(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_search_for_studies(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.SetIamPolicyRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_set_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_set_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}:setIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
StoreInstances stores DICOM instances associated with study instance unique identifiers (SUID). See [Store Transaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.5). For details on the implementation of StoreInstances, see [Store transaction](https://cloud.google.com/healthcare/docs/dicom#store_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call StoreInstances, see [Storing DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#storing_dicom_data).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_store_instances(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_store_instances(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_test_iam_permissions(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_test_iam_permissions(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}:testIamPermissions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}]
)
end
@doc """
DeleteStudy deletes all instances within the given study using a long running operation. The method returns an Operation which will be marked successful when the deletion is complete. Warning: Instances cannot be inserted into a study that is being deleted by an operation until the operation completes. For samples that show how to call DeleteStudy, see [Deleting a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#deleting_a_study_series_or_instance).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the DeleteStudy request. For example, `studies/{study_uid}`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_delete(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
RetrieveStudyMetadata returns instance associated with the given study presented as metadata with the bulk data removed. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveStudyMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveStudyMetadata, see [Retrieving metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_metadata).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveStudyMetadata DICOMweb request. For example, `studies/{study_uid}/metadata`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_retrieve_metadata(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_retrieve_metadata(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/metadata",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
RetrieveStudy returns all instances within the given study. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveStudy, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveStudy, see [Retrieving DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_dicom_data).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveStudy DICOMweb request. For example, `studies/{study_uid}`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_retrieve_study(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_retrieve_study(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
SearchForInstances returns a list of matching instances. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Searching for studies, series, instances, and frames](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#searching_for_studies_series_instances_and_frames).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the SearchForInstancesRequest DICOMweb request. For example, `instances`, `series/{series_uid}/instances`, or `studies/{study_uid}/instances`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_search_for_instances(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_search_for_instances(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/instances",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
SearchForSeries returns a list of matching series. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of SearchForSeries, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForSeries, see [Searching for studies, series, instances, and frames](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#searching_for_studies_series_instances_and_frames).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the SearchForSeries DICOMweb request. For example, `series` or `studies/{study_uid}/series`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_search_for_series(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_search_for_series(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
StoreInstances stores DICOM instances associated with study instance unique identifiers (SUID). See [Store Transaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.5). For details on the implementation of StoreInstances, see [Store transaction](https://cloud.google.com/healthcare/docs/dicom#store_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call StoreInstances, see [Storing DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#storing_dicom_data).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the StoreInstances DICOMweb request. For example, `studies/[{study_uid}]`. Note that the `study_uid` is optional.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_store_instances(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_store_instances(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
DeleteSeries deletes all instances within the given study and series using a long running operation. The method returns an Operation which will be marked successful when the deletion is complete. Warning: Instances cannot be inserted into a series that is being deleted by an operation until the operation completes. For samples that show how to call DeleteSeries, see [Deleting a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#deleting_a_study_series_or_instance).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the DeleteSeries request. For example, `studies/{study_uid}/series/{series_uid}`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_delete(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
RetrieveSeriesMetadata returns instance associated with the given study and series, presented as metadata with the bulk data removed. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveSeriesMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveSeriesMetadata, see [Retrieving metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_metadata).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveSeriesMetadata DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/metadata`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_retrieve_metadata(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_retrieve_metadata(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}/metadata",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
RetrieveSeries returns all instances within the given study and series. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveSeries, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveSeries, see [Retrieving DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_dicom_data).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveSeries DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_retrieve_series(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_retrieve_series(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
SearchForInstances returns a list of matching instances. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Searching for studies, series, instances, and frames](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#searching_for_studies_series_instances_and_frames).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the SearchForInstancesRequest DICOMweb request. For example, `instances`, `series/{series_uid}/instances`, or `studies/{study_uid}/instances`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_search_for_instances(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_search_for_instances(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}/instances",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
DeleteInstance deletes an instance associated with the given study, series, and SOP Instance UID. Delete requests are equivalent to the GET requests specified in the Retrieve transaction. Study and series search results can take a few seconds to be updated after an instance is deleted using DeleteInstance. For samples that show how to call DeleteInstance, see [Deleting a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#deleting_a_study_series_or_instance).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the DeleteInstance request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `instances_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_delete(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
instances_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}/instances/{instancesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &URI.char_unreserved?/1),
"instancesId" => URI.encode(instances_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
RetrieveInstance returns instance associated with the given study, series, and SOP Instance UID. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveInstance, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) and [DICOM instances](https://cloud.google.com/healthcare/docs/dicom#dicom_instances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveInstance, see [Retrieving an instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_an_instance).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveInstance DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `instances_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
instances_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}/instances/{instancesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &URI.char_unreserved?/1),
"instancesId" => URI.encode(instances_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
RetrieveInstanceMetadata returns instance associated with the given study, series, and SOP Instance UID presented as metadata with the bulk data removed. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveInstanceMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveInstanceMetadata, see [Retrieving metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_metadata).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveInstanceMetadata DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/metadata`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `instances_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
instances_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}/instances/{instancesId}/metadata",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &URI.char_unreserved?/1),
"instancesId" => URI.encode(instances_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
RetrieveRenderedInstance returns instance associated with the given study, series, and SOP Instance UID in an acceptable Rendered Media Type. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveRenderedInstance, see [Rendered resources](https://cloud.google.com/healthcare/docs/dicom#rendered_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveRenderedInstance, see [Retrieving consumer image formats](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_consumer_image_formats).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveRenderedInstance DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/rendered`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `instances_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
instances_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}/instances/{instancesId}/rendered",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &URI.char_unreserved?/1),
"instancesId" => URI.encode(instances_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
RetrieveFrames returns instances associated with the given study, series, SOP Instance UID and frame numbers. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveFrames, see [DICOM frames](https://cloud.google.com/healthcare/docs/dicom#dicom_frames) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveFrames, see [Retrieving DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_dicom_data).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveFrames DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/frames/{frame_list}`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `instances_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `frames_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
instances_id,
frames_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}/instances/{instancesId}/frames/{framesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &URI.char_unreserved?/1),
"instancesId" => URI.encode(instances_id, &URI.char_unreserved?/1),
"framesId" => URI.encode(frames_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
RetrieveRenderedFrames returns instances associated with the given study, series, SOP Instance UID and frame numbers in an acceptable Rendered Media Type. See [RetrieveTransaction](http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveRenderedFrames, see [Rendered resources](https://cloud.google.com/healthcare/docs/dicom#rendered_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveRenderedFrames, see [Retrieving consumer image formats](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieving_consumer_image_formats).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `dicom_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `studies_id` (*type:* `String.t`) - Part of `dicomWebPath`. The path of the RetrieveRenderedFrames DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/frames/{frame_list}/rendered`.
* `series_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `instances_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `frames_id` (*type:* `String.t`) - Part of `dicomWebPath`. See documentation of `studiesId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(
connection,
projects_id,
locations_id,
datasets_id,
dicom_stores_id,
studies_id,
series_id,
instances_id,
frames_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/dicomStores/{dicomStoresId}/dicomWeb/studies/{studiesId}/series/{seriesId}/instances/{instancesId}/frames/{framesId}/rendered",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"dicomStoresId" => URI.encode(dicom_stores_id, &URI.char_unreserved?/1),
"studiesId" => URI.encode(studies_id, &URI.char_unreserved?/1),
"seriesId" => URI.encode(series_id, &URI.char_unreserved?/1),
"instancesId" => URI.encode(instances_id, &URI.char_unreserved?/1),
"framesId" => URI.encode(frames_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Creates a new FHIR store within the parent dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the dataset this FHIR store belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:fhirStoreId` (*type:* `String.t`) - The ID of the FHIR store that is being created. The string must match the following regex: `[\\p{L}\\p{N}_\\-\\.]{1,256}`.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.FhirStore.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.FhirStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.FhirStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_create(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:fhirStoreId => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.FhirStore{}])
end
@doc """
De-identifies data from the source store and writes it to the destination store. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifyFhirStoreSummary. The number of resources processed are tracked in Operation.metadata. Error details are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `sourceStore`. Source FHIR store resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `sourceStore`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `sourceStore`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `sourceStore`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.DeidentifyFhirStoreRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_deidentify(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_deidentify(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}:deidentify",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Deletes the specified FHIR store and removes all resources within it.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the FHIR store to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_delete(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Export resources from the FHIR store to the specified destination. This method returns an Operation that can be used to track the status of the export by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type ExportResourcesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the FHIR store to export resource from, in the format of `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ExportResourcesRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_export(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_export(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}:export",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Gets the configuration of the specified FHIR store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the FHIR store to get.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.FhirStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.FhirStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_get(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.FhirStore{}])
end
@doc """
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:"options.requestedPolicyVersion"` (*type:* `integer()`) - Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_get_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_get_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:"options.requestedPolicyVersion" => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}:getIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Import resources to the FHIR store by loading data from the specified sources. This method is optimized to load large quantities of data using import semantics that ignore some FHIR store configuration options and are not suitable for all use cases. It is primarily intended to load data into an empty FHIR store that is not being used by other clients. In cases where this method is not appropriate, consider using ExecuteBundle to load data. Every resource in the input must contain a client-supplied ID. Each resource is stored using the supplied ID regardless of the enable_update_create setting on the FHIR store. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Cloud Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. The import process does not enforce referential integrity, regardless of the disable_referential_integrity setting on the FHIR store. This allows the import of resources with arbitrary interdependencies without considering grouping or ordering, but if the input data contains invalid references or if some resources fail to be imported, the FHIR store might be left in a state that violates referential integrity. The import process does not trigger Pub/Sub notification or BigQuery streaming update, regardless of how those are configured on the FHIR store. If a resource with the specified ID already exists, the most recent version of the resource is overwritten without creating a new historical version, regardless of the disable_resource_versioning setting on the FHIR store. If transient failures occur during the import, it is possible that successfully imported resources will be overwritten more than once. The import operation is idempotent unless the input data contains multiple valid resources with the same ID but different contents. In that case, after the import completes, the store contains exactly one resource with that ID but there is no ordering guarantee on which version of the contents it will have. The operation result counters do not count duplicate IDs as an error and count one success for each resource in the input, which might result in a success count larger than the number of resources in the FHIR store. This often occurs when importing data organized in bundles produced by Patient-everything where each bundle contains its own copy of a resource such as Practitioner that might be referred to by many patients. If some resources fail to import, for example due to parsing errors, successfully imported resources are not rolled back. The location and format of the input data are specified by the parameters in ImportResourcesRequest. Note that if no format is specified, this method assumes the `BUNDLE` format. When using the `BUNDLE` format this method ignores the `Bundle.type` field, except that `history` bundles are rejected, and does not apply any of the bundle processing semantics for batch or transaction bundles. Unlike in ExecuteBundle, transaction bundles are not executed as a single transaction and bundle-internal references are not rewritten. The bundle is treated as a collection of resources to be written as provided in `Bundle.entry.resource`, ignoring `Bundle.entry.request`. As an example, this allows the import of `searchset` bundles produced by a FHIR search or Patient-everything operation. This method returns an Operation that can be used to track the status of the import by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type ImportResourcesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the FHIR store to import FHIR resources to, in the format of `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ImportResourcesRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_import(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_import(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}:import",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Lists the FHIR stores in the given dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the dataset.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Restricts stores returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Only filtering on labels is supported, for example `labels.key=value`.
* `:pageSize` (*type:* `integer()`) - Limit on the number of FHIR stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - The next_page_token value returned from the previous List request, if any.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListFhirStoresResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListFhirStoresResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_list(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListFhirStoresResponse{}]
)
end
@doc """
Updates the configuration of the specified FHIR store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `fhirStore.name`. Output only. Resource name of the FHIR store, of the form `projects/{project_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `fhirStore.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `fhirStore.name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `fhirStore.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.FhirStore.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.FhirStore{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.FhirStore.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_patch(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.FhirStore{}])
end
@doc """
Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.SetIamPolicyRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_set_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_set_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}:setIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_test_iam_permissions(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_test_iam_permissions(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}:testIamPermissions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}]
)
end
@doc """
Translates a code from one value set to another by searching for appropriate concept maps. Implements the FHIR standard $translate operation ([DSTU2](https://www.hl7.org/fhir/DSTU2/operation-conceptmap-translate.html), [STU3](https://www.hl7.org/fhir/STU3/operation-conceptmap-translate.html), [R4](https://www.hl7.org/fhir/R4/operation-conceptmap-translate.html)). On success, the response body contains a JSON-encoded representation of a FHIR Parameters resource, which includes the translation result. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name for the FHIR store containing the concept map(s) to use for the translation.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:code` (*type:* `String.t`) - The code to translate.
* `:conceptMapVersion` (*type:* `String.t`) - The version of the concept map to use. If unset, the most current version is used.
* `:source` (*type:* `String.t`) - The source value set of the concept map to be used. If unset, target is used to search for concept maps.
* `:system` (*type:* `String.t`) - The system for the code to be translated.
* `:target` (*type:* `String.t`) - The target value set of the concept map to be used. If unset, source is used to search for concept maps.
* `:url` (*type:* `String.t`) - The canonical url of the concept map to use. If unset, the source and target is used to search for concept maps.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir__concept_map_search_translate(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir__concept_map_search_translate(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:code => :query,
:conceptMapVersion => :query,
:source => :query,
:system => :query,
:target => :query,
:url => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/ConceptMap/$translate",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Translates a code from one value set to another using a concept map. You can provide your own concept maps to translate any code system to another code system. Implements the FHIR standard $translate operation ([DSTU2](https://www.hl7.org/fhir/DSTU2/operation-conceptmap-translate.html), [STU3](https://www.hl7.org/fhir/STU3/operation-conceptmap-translate.html), [R4](https://www.hl7.org/fhir/R4/operation-conceptmap-translate.html)). On success, the response body contains a JSON-encoded representation of a FHIR Parameters resource, which includes the translation result. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The URL for the concept map to use for the translation.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `concept_map_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:code` (*type:* `String.t`) - The code to translate.
* `:conceptMapVersion` (*type:* `String.t`) - The version of the concept map to use. If unset, the most current version is used.
* `:system` (*type:* `String.t`) - The system for the code to be translated.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir__concept_map_translate(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir__concept_map_translate(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
concept_map_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:code => :query,
:conceptMapVersion => :query,
:system => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/ConceptMap/{ConceptMapId}/$translate",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"ConceptMapId" => URI.encode(concept_map_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Retrieves the N most recent `Observation` resources for a subject matching search criteria specified as query parameters, grouped by `Observation.code`, sorted from most recent to oldest. Implements the FHIR extended operation Observation-lastn ([STU3](https://hl7.org/implement/standards/fhir/STU3/observation-operations.html#lastn), [R4](https://hl7.org/implement/standards/fhir/R4/observation-operations.html#lastn)). DSTU2 doesn't define the Observation-lastn method, but the server supports it the same way it supports STU3. Search terms are provided as query parameters following the same pattern as the search method. The following search parameters must be provided: - `subject` or `patient` to specify a subject for the Observation. - `code`, `category` or any of the composite parameters that include `code`. Any other valid Observation search parameters can also be provided. This operation accepts an additional query parameter `max`, which specifies N, the maximum number of Observations to return from each group, with a default of 1. Searches with over 1000 results are rejected. Results are counted before grouping and limiting the results with `max`. To stay within the limit, constrain these searches using Observation search parameters such as `_lastUpdated` or `date`. On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the operation. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the FHIR store to retrieve resources from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir__observation_lastn(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir__observation_lastn(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/Observation/$lastn",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Retrieves a Patient resource and resources related to that patient. Implements the FHIR extended operation Patient-everything ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/patient-operations.html#everything), [STU3](https://hl7.org/implement/standards/fhir/STU3/patient-operations.html#everything), [R4](https://hl7.org/implement/standards/fhir/R4/patient-operations.html#everything)). On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the operation. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The resources in scope for the response are: * The patient resource itself. * All the resources directly referenced by the patient resource. * Resources directly referencing the patient resource that meet the inclusion criteria. The inclusion criteria are based on the membership rules in the patient compartment definition ([DSTU2](https://hl7.org/fhir/DSTU2/compartment-patient.html), [STU3](http://www.hl7.org/fhir/stu3/compartmentdefinition-patient.html), [R4](https://hl7.org/fhir/R4/compartmentdefinition-patient.html)), which details the eligible resource types and referencing search parameters. For samples that show how to call `Patient-everything`, see [Getting all patient compartment resources](/healthcare/docs/how-tos/fhir-resources#getting_all_patient_compartment_resources).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Name of the `Patient` resource for which the information is required.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `patient_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:_count` (*type:* `integer()`) - Maximum number of resources in a page. If not specified, 100 is used. May not be larger than 1000.
* `:_page_token` (*type:* `String.t`) - Used to retrieve the next or previous page of results when using pagination. Set `_page_token` to the value of _page_token set in next or previous page links' url. Next and previous page are returned in the response bundle's links field, where `link.relation` is "previous" or "next". Omit `_page_token` if no previous request has been made.
* `:_since` (*type:* `String.t`) - If provided, only resources updated after this time are returned. The time uses the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. For example, `2015-02-07T13:28:17.239+02:00` or `2017-01-01T00:00:00Z`. The time must be specified to the second and include a time zone.
* `:_type` (*type:* `String.t`) - String of comma-delimited FHIR resource types. If provided, only resources of the specified resource type(s) are returned.
* `:end` (*type:* `String.t`) - The response includes records prior to the end date. If no end date is provided, all records subsequent to the start date are in scope.
* `:start` (*type:* `String.t`) - The response includes records subsequent to the start date. If no start date is provided, all records prior to the end date are in scope.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir__patient_everything(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir__patient_everything(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
patient_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:_count => :query,
:_page_token => :query,
:_since => :query,
:_type => :query,
:end => :query,
:start => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/Patient/{PatientId}/$everything",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"PatientId" => URI.encode(patient_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Deletes all the historical versions of a resource (excluding the current version) from the FHIR store. To remove all versions of a resource, first delete the current version and then call this method. This is not a FHIR standard operation. For samples that show how to call `Resource-purge`, see [Deleting historical versions of a FHIR resource](/healthcare/docs/how-tos/fhir-resources#deleting_historical_versions_of_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the resource to purge.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id1` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir__resource_purge(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir__resource_purge(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
fhir_id1,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}/$purge",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &URI.char_unreserved?/1),
"fhirId1" => URI.encode(fhir_id1, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Validates an input FHIR resource's conformance to its profiles and the profiles configured on the FHIR store. Implements the FHIR extended operation $validate ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resource-operations.html#validate), [STU3](http://hl7.org/implement/standards/fhir/STU3/resource-operations.html#validate), or [R4](http://hl7.org/implement/standards/fhir/R4/resource-operation-validate.html)). The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. The `Parameters` input syntax is not supported. The `profile` query parameter can be used to request that the resource only be validated against a specific profile. If a profile with the given URL cannot be found in the FHIR store then an error is returned. Errors generated by validation contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the FHIR store that holds the profiles being used for validation.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `type`. The FHIR resource type of the resource being validated. For a complete list, see the FHIR Resource Index ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html), or [R4](http://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:profile` (*type:* `String.t`) - A profile that this resource should be validated against.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir__resource_validate(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir__resource_validate(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:profile => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/$validate",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Gets the FHIR capability statement ([STU3](https://hl7.org/implement/standards/fhir/STU3/capabilitystatement.html), [R4](https://hl7.org/implement/standards/fhir/R4/capabilitystatement.html)), or the [conformance statement](https://hl7.org/implement/standards/fhir/DSTU2/conformance.html) in the DSTU2 case for the store, which contains a description of functionality supported by the server. Implements the FHIR standard capabilities interaction ([STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#capabilities), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#capabilities)), or the [conformance interaction](https://hl7.org/implement/standards/fhir/DSTU2/http.html#conformance) in the DSTU2 case. On success, the response body contains a JSON-encoded representation of a `CapabilityStatement` resource.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. Name of the FHIR store to retrieve the capabilities for.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_capabilities(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_capabilities(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/metadata",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Deletes FHIR resources that match a search query. Implements the FHIR standard conditional delete interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.12.1), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.13.1), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#3.1.0.7.1)). If multiple resources match, all matching resources are deleted. Search terms are provided as query parameters following the same pattern as the search method. Note: Unless resource versioning is disabled by setting the disable_resource_versioning flag on the FHIR store, the deleted resources are moved to a history repository that can still be retrieved through vread and related methods, unless they are removed by the purge method. This method requires the`healthcare.fhirStores.searchResources` and `healthcare.fhirResources.delete` permissions on the parent FHIR store. For samples that show how to call `conditionalDelete`, see [Conditionally deleting a FHIR resource](/healthcare/docs/how-tos/fhir-resources#conditionally_deleting_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the FHIR store this resource belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `type`. The FHIR resource type to delete, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_conditional_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_conditional_delete(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
If a resource is found based on the search criteria specified in the query parameters, updates part of that resource by applying the operations specified in a [JSON Patch](http://jsonpatch.com/) document. Implements the FHIR standard conditional patch interaction ([STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#patch), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#patch)). DSTU2 doesn't define a conditional patch method, but the server supports it in the same way it supports STU3. Search terms are provided as query parameters following the same pattern as the search method. If the search criteria identify more than one match, the request returns a `412 Precondition Failed` error. The request body must contain a JSON Patch document, and the request headers must contain `Content-Type: application/json-patch+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. This method requires the`healthcare.fhirStores.searchResources` permission on the parent FHIR store and the `healthcare.fhirResources.patch` permission on the requested FHIR store resource. For samples that show how to call `conditionalPatch`, see [Conditionally patching a FHIR resource](/healthcare/docs/how-tos/fhir-resources#conditionally_patching_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the FHIR store this resource belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `type`. The FHIR resource type to update, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_conditional_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_conditional_patch(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
If a resource is found based on the search criteria specified in the query parameters, updates the entire contents of that resource. Implements the FHIR standard conditional update interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.10.2), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#cond-update), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#cond-update)). Search terms are provided as query parameters following the same pattern as the search method. If the search criteria identify more than one match, the request returns a `412 Precondition Failed` error. If the search criteria identify zero matches, and the supplied resource body contains an `id`, and the FHIR store has enable_update_create set, creates the resource with the client-specified ID. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. If the search criteria identify zero matches, and the supplied resource body does not contain an `id`, the resource is created with a server-assigned ID as per the create method. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. This method requires the`healthcare.fhirStores.searchResources` and `healthcare.fhirResources.update` permissions on the parent FHIR store. For samples that show how to call `conditionalUpdate`, see [Conditionally updating a FHIR resource](/healthcare/docs/how-tos/fhir-resources#conditionally_updating_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the FHIR store this resource belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `type`. The FHIR resource type to update, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_conditional_update(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_conditional_update(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:put)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Creates a FHIR resource. Implements the FHIR standard create interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#create), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#create), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#create)), which creates a new resource with a server-assigned resource ID. Also supports the FHIR standard conditional create interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#ccreate), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#ccreate), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#ccreate)), specified by supplying an `If-None-Exist` header containing a FHIR search query. If no resources match this search query, the server processes the create operation as normal. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. On success, the response body contains a JSON-encoded representation of the resource as it was created on the server, including the server-assigned resource ID and version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `create`, see [Creating a FHIR resource](/healthcare/docs/how-tos/fhir-resources#creating_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the FHIR store this resource belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `type`. The FHIR resource type to create, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_create(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Deletes a FHIR resource. Implements the FHIR standard delete interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#delete), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#delete), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#delete)). Note: Unless resource versioning is disabled by setting the disable_resource_versioning flag on the FHIR store, the deleted resources are moved to a history repository that can still be retrieved through vread and related methods, unless they are removed by the purge method. For samples that show how to call `delete`, see [Deleting a FHIR resource](/healthcare/docs/how-tos/fhir-resources#deleting_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the resource to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id1` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_delete(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
fhir_id1,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &URI.char_unreserved?/1),
"fhirId1" => URI.encode(fhir_id1, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Executes all the requests in the given Bundle. Implements the FHIR standard batch/transaction interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#transaction), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#transaction), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#transaction)). Supports all interactions within a bundle, except search. This method accepts Bundles of type `batch` and `transaction`, processing them according to the batch processing rules ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.16.1), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.17.1), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#brules)) and transaction processing rules ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.16.2), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.17.2), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#trules)). The request body must contain a JSON-encoded FHIR `Bundle` resource, and the request headers must contain `Content-Type: application/fhir+json`. For a batch bundle or a successful transaction the response body contains a JSON-encoded representation of a `Bundle` resource of type `batch-response` or `transaction-response` containing one entry for each entry in the request, with the outcome of processing the entry. In the case of an error for a transaction bundle, the response body contains a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. This method requires permission for executing the requests in the bundle. The `executeBundle` permission grants permission to execute the request in the bundle but you must grant sufficient permissions to execute the individual requests in the bundle. For example, if the bundle contains a `create` request, you must have permission to execute the `create` request. Logging is available for the `executeBundle` permission. For samples that show how to call `executeBundle`, see [Managing FHIR resources using FHIR bundles](/healthcare/docs/how-tos/fhir-bundles).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the FHIR store in which this bundle will be executed.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_execute_bundle(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_execute_bundle(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Lists all the versions of a resource (including the current version and deleted versions) from the FHIR store. Implements the per-resource form of the FHIR standard history interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#history), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#history), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#history)). On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `history`, containing the version history sorted from most recent to oldest versions. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `history`, see [Listing FHIR resource versions](/healthcare/docs/how-tos/fhir-resources#listing_fhir_resource_versions).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the resource to retrieve.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id1` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:_at` (*type:* `String.t`) - Only include resource versions that were current at some point during the time period specified in the date time value. The date parameter format is yyyy-mm-ddThh:mm:ss[Z|(+|-)hh:mm] Clients may specify any of the following: * An entire year: `_at=2019` * An entire month: `_at=2019-01` * A specific day: `_at=2019-01-20` * A specific second: `_at=2018-12-31T23:59:58Z`
* `:_count` (*type:* `integer()`) - The maximum number of search results on a page. If not specified, 100 is used. May not be larger than 1000.
* `:_page_token` (*type:* `String.t`) - Used to retrieve the first, previous, next, or last page of resource versions when using pagination. Value should be set to the value of `_page_token` set in next or previous page links' URLs. Next and previous page are returned in the response bundle's links field, where `link.relation` is "previous" or "next". Omit `_page_token` if no previous request has been made.
* `:_since` (*type:* `String.t`) - Only include resource versions that were created at or after the given instant in time. The instant in time uses the format YYYY-MM-DDThh:mm:ss.sss+zz:zz (for example 2015-02-07T13:28:17.239+02:00 or 2017-01-01T00:00:00Z). The time must be specified to the second and include a time zone.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_history(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_history(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
fhir_id1,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:_at => :query,
:_count => :query,
:_page_token => :query,
:_since => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}/_history",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &URI.char_unreserved?/1),
"fhirId1" => URI.encode(fhir_id1, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Updates part of an existing resource by applying the operations specified in a [JSON Patch](http://jsonpatch.com/) document. Implements the FHIR standard patch interaction ([STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#patch), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#patch)). DSTU2 doesn't define a patch method, but the server supports it in the same way it supports STU3. The request body must contain a JSON Patch document, and the request headers must contain `Content-Type: application/json-patch+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `patch`, see [Patching a FHIR resource](/healthcare/docs/how-tos/fhir-resources#patching_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the resource to update.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id1` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_patch(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
fhir_id1,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &URI.char_unreserved?/1),
"fhirId1" => URI.encode(fhir_id1, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Gets the contents of a FHIR resource. Implements the FHIR standard read interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#read), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#read), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#read)). Also supports the FHIR standard conditional read interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#cread), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#cread), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#cread)) specified by supplying an `If-Modified-Since` header with a date/time value or an `If-None-Match` header with an ETag value. On success, the response body contains a JSON-encoded representation of the resource. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `read`, see [Getting a FHIR resource](/healthcare/docs/how-tos/fhir-resources#getting_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the resource to retrieve.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id1` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_read(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_read(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
fhir_id1,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &URI.char_unreserved?/1),
"fhirId1" => URI.encode(fhir_id1, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Searches for resources in the given FHIR store according to criteria specified as query parameters. Implements the FHIR standard search interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#search), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#search), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#search)) using the search semantics described in the FHIR Search specification ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/search.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/search.html), [R4](https://hl7.org/implement/standards/fhir/R4/search.html)). Supports four methods of search defined by the specification: * `GET [base]?[parameters]` to search across all resources. * `GET [base]/[type]?[parameters]` to search resources of a specified type. * `POST [base]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method across all resources. * `POST [base]/[type]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method for the specified type. The `GET` and `POST` methods do not support compartment searches. The `POST` method does not support `application/x-www-form-urlencoded` search parameters. On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the search. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The server's capability statement, retrieved through capabilities, indicates what search parameters are supported on each FHIR resource. A list of all search parameters defined by the specification can be found in the FHIR Search Parameter Registry ([STU3](https://hl7.org/implement/standards/fhir/STU3/searchparameter-registry.html), [R4](https://hl7.org/implement/standards/fhir/R4/searchparameter-registry.html)). FHIR search parameters for DSTU2 can be found on each resource's definition page. Supported search modifiers: `:missing`, `:exact`, `:contains`, `:text`, `:in`, `:not-in`, `:above`, `:below`, `:[type]`, `:not`, and `:recurse`. Supported search result parameters: `_sort`, `_count`, `_include`, `_revinclude`, `_summary=text`, `_summary=data`, and `_elements`. The maximum number of search results returned defaults to 100, which can be overridden by the `_count` parameter up to a maximum limit of 1000. If there are additional results, the returned `Bundle` contains pagination links. Resources with a total size larger than 5MB or a field count larger than 50,000 might not be fully searchable as the server might trim its generated search index in those cases. Note: FHIR resources are indexed asynchronously, so there might be a slight delay between the time a resource is created or changes and when the change is reflected in search results. For samples and detailed information, see [Searching for FHIR resources](/healthcare/docs/how-tos/fhir-search) and [Advanced FHIR search features](/healthcare/docs/how-tos/fhir-advanced-search).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the FHIR store to retrieve resources from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.SearchResourcesRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_search(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_search(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/_search",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Searches for resources in the given FHIR store according to criteria specified as query parameters. Implements the FHIR standard search interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#search), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#search), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#search)) using the search semantics described in the FHIR Search specification ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/search.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/search.html), [R4](https://hl7.org/implement/standards/fhir/R4/search.html)). Supports four methods of search defined by the specification: * `GET [base]?[parameters]` to search across all resources. * `GET [base]/[type]?[parameters]` to search resources of a specified type. * `POST [base]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method across all resources. * `POST [base]/[type]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method for the specified type. The `GET` and `POST` methods do not support compartment searches. The `POST` method does not support `application/x-www-form-urlencoded` search parameters. On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the search. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The server's capability statement, retrieved through capabilities, indicates what search parameters are supported on each FHIR resource. A list of all search parameters defined by the specification can be found in the FHIR Search Parameter Registry ([STU3](https://hl7.org/implement/standards/fhir/STU3/searchparameter-registry.html), [R4](https://hl7.org/implement/standards/fhir/R4/searchparameter-registry.html)). FHIR search parameters for DSTU2 can be found on each resource's definition page. Supported search modifiers: `:missing`, `:exact`, `:contains`, `:text`, `:in`, `:not-in`, `:above`, `:below`, `:[type]`, `:not`, and `:recurse`. Supported search result parameters: `_sort`, `_count`, `_include`, `_revinclude`, `_summary=text`, `_summary=data`, and `_elements`. The maximum number of search results returned defaults to 100, which can be overridden by the `_count` parameter up to a maximum limit of 1000. If there are additional results, the returned `Bundle` contains pagination links. Resources with a total size larger than 5MB or a field count larger than 50,000 might not be fully searchable as the server might trim its generated search index in those cases. Note: FHIR resources are indexed asynchronously, so there might be a slight delay between the time a resource is created or changes and when the change is reflected in search results. For samples and detailed information, see [Searching for FHIR resources](/healthcare/docs/how-tos/fhir-search) and [Advanced FHIR search features](/healthcare/docs/how-tos/fhir-advanced-search).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the FHIR store to retrieve resources from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `resource_type` (*type:* `String.t`) - The FHIR resource type to search, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.SearchResourcesRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_search_type(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_search_type(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
resource_type,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{resourceType}/_search",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"resourceType" => URI.encode(resource_type, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Updates the entire contents of a resource. Implements the FHIR standard update interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#update), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#update), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#update)). If the specified resource does not exist and the FHIR store has enable_update_create set, creates the resource with the client-specified ID. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. The resource must contain an `id` element having an identical value to the ID in the REST path of the request. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `update`, see [Updating a FHIR resource](/healthcare/docs/how-tos/fhir-resources#updating_a_fhir_resource).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the resource to update.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id1` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.HttpBody.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_update(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_update(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
fhir_id1,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:put)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &URI.char_unreserved?/1),
"fhirId1" => URI.encode(fhir_id1, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Gets the contents of a version (current or historical) of a FHIR resource by version ID. Implements the FHIR standard vread interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#vread), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#vread), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#vread)). On success, the response body contains a JSON-encoded representation of the resource. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `vread`, see [Retrieving a FHIR resource version](/healthcare/docs/how-tos/fhir-resources#retrieving_a_fhir_resource_version).
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the resource version to retrieve.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `fhir_id1` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `_history_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_fhir_stores_fhir_vread(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.HttpBody.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_fhir_stores_fhir_vread(
connection,
projects_id,
locations_id,
datasets_id,
fhir_stores_id,
fhir_id,
fhir_id1,
_history_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/fhirStores/{fhirStoresId}/fhir/{fhirId}/{fhirId1}/_history/{_historyId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"fhirStoresId" => URI.encode(fhir_stores_id, &URI.char_unreserved?/1),
"fhirId" => URI.encode(fhir_id, &URI.char_unreserved?/1),
"fhirId1" => URI.encode(fhir_id1, &URI.char_unreserved?/1),
"_historyId" => URI.encode(_history_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.HttpBody{}])
end
@doc """
Creates a new HL7v2 store within the parent dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the dataset this HL7v2 store belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:hl7V2StoreId` (*type:* `String.t`) - The ID of the HL7v2 store that is being created. The string must match the following regex: `[\\p{L}\\p{N}_\\-\\.]{1,256}`.
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_create(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:hl7V2StoreId => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store{}])
end
@doc """
Deletes the specified HL7v2 store and removes all messages that it contains.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the HL7v2 store to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_delete(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Exports the messages to a destination. To filter messages to be exported, define a filter using the start and end time, relative to the message generation time (MSH.7). This API returns an Operation that can be used to track the status of the job by calling GetOperation. Immediate fatal errors appear in the error field. Otherwise, when the operation finishes, a detailed response of type ExportMessagesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the source HL7v2 store, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl7v2_store_id}`
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ExportMessagesRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_export(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_export(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}:export",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Gets the specified HL7v2 store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the HL7v2 store to get.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_get(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store{}])
end
@doc """
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:"options.requestedPolicyVersion"` (*type:* `integer()`) - Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_get_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_get_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:"options.requestedPolicyVersion" => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}:getIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Import messages to the HL7v2 store by loading data from the specified sources. This method is optimized to load large quantities of data using import semantics that ignore some HL7v2 store configuration options and are not suitable for all use cases. It is primarily intended to load data into an empty HL7v2 store that is not being used by other clients. An existing message will be overwritten if a duplicate message is imported. A duplicate message is a message with the same raw bytes as a message that already exists in this HL7v2 store. When a message is overwritten, its labels will also be overwritten. The import operation is idempotent unless the input data contains multiple valid messages with the same raw bytes but different labels. In that case, after the import completes, the store contains exactly one message with those raw bytes but there is no ordering guarantee on which version of the labels it has. The operation result counters do not count duplicated raw bytes as an error and count one success for each message in the input, which might result in a success count larger than the number of messages in the HL7v2 store. If some messages fail to import, for example due to parsing errors, successfully imported messages are not rolled back. This method returns an Operation that can be used to track the status of the import by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a response of type ImportMessagesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the target HL7v2 store, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl7v2_store_id}`
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.ImportMessagesRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_import(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_import(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}:import",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Lists the HL7v2 stores in the given dataset.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the dataset.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Restricts stores returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Only filtering on labels is supported. For example, `labels.key=value`.
* `:pageSize` (*type:* `integer()`) - Limit on the number of HL7v2 stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - The next_page_token value returned from the previous List request, if any.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListHl7V2StoresResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListHl7V2StoresResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_list(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListHl7V2StoresResponse{}]
)
end
@doc """
Updates the HL7v2 store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `hl7V2Store.name`. Resource name of the HL7v2 store, of the form `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `hl7V2Store.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `hl7V2Store.name`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `hl7V2Store.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_patch(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Hl7V2Store{}])
end
@doc """
Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.SetIamPolicyRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Policy{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_set_iam_policy(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Policy.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_set_iam_policy(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}:setIamPolicy",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Policy{}])
end
@doc """
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `resource`. REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
* `locations_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `resource`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_test_iam_permissions(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_test_iam_permissions(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}:testIamPermissions",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.TestIamPermissionsResponse{}]
)
end
@doc """
Gets multiple messages in the given HL7v2 store.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the HL7v2 store to retrieve messages from, in the format: `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl7v2_store_id}`.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:ids` (*type:* `list(String.t)`) - The resource id of the HL7v2 messages to retrieve in the format: `{message_id}`, where the full resource name is `{parent}/messages/{message_id}` A maximum of 100 messages can be retrieved in a batch. All 'ids' have to be under parent.
* `:view` (*type:* `String.t`) - Specifies the parts of the Messages resource to return in the response. When unspecified, equivalent to BASIC.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.BatchGetMessagesResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_messages_batch_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.BatchGetMessagesResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_messages_batch_get(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:ids => :query,
:view => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}/messages:batchGet",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.BatchGetMessagesResponse{}]
)
end
@doc """
Parses and stores an HL7v2 message. This method triggers an asynchronous notification to any Pub/Sub topic configured in Hl7V2Store.Hl7V2NotificationConfig, if the filtering matches the message. If an MLLP adapter is configured to listen to a Pub/Sub topic, the adapter transmits the message when a notification is received.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the dataset this message belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.CreateMessageRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Message{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_messages_create(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Message.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_messages_create(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}/messages",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Message{}])
end
@doc """
Deletes an HL7v2 message.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the HL7v2 message to delete.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `messages_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_messages_delete(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_messages_delete(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
messages_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}/messages/{messagesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1),
"messagesId" => URI.encode(messages_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Gets an HL7v2 message.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The resource name of the HL7v2 message to retrieve.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `messages_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:view` (*type:* `String.t`) - Specifies which parts of the Message resource to return in the response. When unspecified, equivalent to FULL.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Message{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_messages_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Message.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_messages_get(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
messages_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:view => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}/messages/{messagesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1),
"messagesId" => URI.encode(messages_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Message{}])
end
@doc """
Parses and stores an HL7v2 message. This method triggers an asynchronous notification to any Pub/Sub topic configured in Hl7V2Store.Hl7V2NotificationConfig, if the filtering matches the message. If an MLLP adapter is configured to listen to a Pub/Sub topic, the adapter transmits the message when a notification is received. If the method is successful, it generates a response containing an HL7v2 acknowledgment (`ACK`) message. If the method encounters an error, it returns a negative acknowledgment (`NACK`) message. This behavior is suitable for replying to HL7v2 interface systems that expect these acknowledgments.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. The name of the HL7v2 store this message belongs to.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.IngestMessageRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.IngestMessageResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_messages_ingest(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.IngestMessageResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_messages_ingest(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}/messages:ingest",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.IngestMessageResponse{}]
)
end
@doc """
Lists all the messages in the given HL7v2 store with support for filtering. Note: HL7v2 messages are indexed asynchronously, so there might be a slight delay between the time a message is created and when it can be found through a filter.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `parent`. Name of the HL7v2 store to retrieve messages from.
* `locations_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `parent`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - Restricts messages returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Fields/functions available for filtering are: * `message_type`, from the MSH-9.1 field. For example, `NOT message_type = "ADT"`. * `send_date` or `sendDate`, the YYYY-MM-DD date the message was sent in the dataset's time_zone, from the MSH-7 segment. For example, `send_date < "2017-01-02"`. * `send_time`, the timestamp when the message was sent, using the RFC3339 time format for comparisons, from the MSH-7 segment. For example, `send_time < "2017-01-02T00:00:00-05:00"`. * `create_time`, the timestamp when the message was created in the HL7v2 store. Use the RFC3339 time format for comparisons. For example, `create_time < "2017-01-02T00:00:00-05:00"`. * `send_facility`, the care center that the message came from, from the MSH-4 segment. For example, `send_facility = "ABC"`. * `PatientId(value, type)`, which matches if the message lists a patient having an ID of the given value and type in the PID-2, PID-3, or PID-4 segments. For example, `PatientId("123456", "MRN")`. * `labels.x`, a string value of the label with key `x` as set using the Message.labels map. For example, `labels."priority"="high"`. The operator `:*` can be used to assert the existence of a label. For example, `labels."priority":*`.
* `:orderBy` (*type:* `String.t`) - Orders messages returned by the specified order_by clause. Syntax: https://cloud.google.com/apis/design/design_patterns#sorting_order Fields available for ordering are: * `send_time`
* `:pageSize` (*type:* `integer()`) - Limit on the number of messages to return in a single response. If not specified, 100 is used. May not be larger than 1000.
* `:pageToken` (*type:* `String.t`) - The next_page_token value returned from the previous List request, if any.
* `:view` (*type:* `String.t`) - Specifies the parts of the Message to return in the response. When unspecified, equivalent to BASIC. Setting this to anything other than BASIC with a `page_size` larger than the default can generate a large response, which impacts the performance of this method.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListMessagesResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_messages_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListMessagesResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_messages_list(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:orderBy => :query,
:pageSize => :query,
:pageToken => :query,
:view => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}/messages",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListMessagesResponse{}]
)
end
@doc """
Update the message. The contents of the message in Message.data and data extracted from the contents such as Message.create_time can't be altered. Only the Message.labels field is allowed to be updated. The labels in the request are merged with the existing set of labels. Existing labels with the same keys are updated.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `message.name`. Resource name of the Message, of the form `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message_id}`. Assigned by the server.
* `locations_id` (*type:* `String.t`) - Part of `message.name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `message.name`. See documentation of `projectsId`.
* `hl7_v2_stores_id` (*type:* `String.t`) - Part of `message.name`. See documentation of `projectsId`.
* `messages_id` (*type:* `String.t`) - Part of `message.name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:updateMask` (*type:* `String.t`) - The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.Message.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Message{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_hl7_v2_stores_messages_patch(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Message.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_hl7_v2_stores_messages_patch(
connection,
projects_id,
locations_id,
datasets_id,
hl7_v2_stores_id,
messages_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/hl7V2Stores/{hl7V2StoresId}/messages/{messagesId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"hl7V2StoresId" => URI.encode(hl7_v2_stores_id, &URI.char_unreserved?/1),
"messagesId" => URI.encode(messages_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Message{}])
end
@doc """
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the operation resource to be cancelled.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `operations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.CancelOperationRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Empty{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_operations_cancel(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_operations_cancel(
connection,
projects_id,
locations_id,
datasets_id,
operations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/operations/{operationsId}:cancel",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"operationsId" => URI.encode(operations_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Empty{}])
end
@doc """
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the operation resource.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `operations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_operations_get(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_operations_get(
connection,
projects_id,
locations_id,
datasets_id,
operations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/operations/{operationsId}",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1),
"operationsId" => URI.encode(operations_id, &(URI.char_unreserved?(&1) || &1 == ?/))
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.Operation{}])
end
@doc """
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `name`. The name of the operation's parent resource.
* `locations_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `datasets_id` (*type:* `String.t`) - Part of `name`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:filter` (*type:* `String.t`) - The standard list filter.
* `:pageSize` (*type:* `integer()`) - The standard list page size.
* `:pageToken` (*type:* `String.t`) - The standard list page token.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.ListOperationsResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_datasets_operations_list(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.ListOperationsResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_datasets_operations_list(
connection,
projects_id,
locations_id,
datasets_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:filter => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/datasets/{datasetsId}/operations",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1),
"datasetsId" => URI.encode(datasets_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.ListOperationsResponse{}]
)
end
@doc """
Analyze heathcare entity in a document. Its response includes the recognized entity mentions and the relationships between them. AnalyzeEntities uses context aware models to detect entities.
## Parameters
* `connection` (*type:* `GoogleApi.HealthCare.V1beta1.Connection.t`) - Connection to server
* `projects_id` (*type:* `String.t`) - Part of `nlpService`. The resource name of the service of the form: "projects/{project_id}/locations/{location_id}/services/nlp".
* `locations_id` (*type:* `String.t`) - Part of `nlpService`. See documentation of `projectsId`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.HealthCare.V1beta1.Model.AnalyzeEntitiesRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.HealthCare.V1beta1.Model.AnalyzeEntitiesResponse{}}` on success
* `{:error, info}` on failure
"""
@spec healthcare_projects_locations_services_nlp_analyze_entities(
Tesla.Env.client(),
String.t(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.HealthCare.V1beta1.Model.AnalyzeEntitiesResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def healthcare_projects_locations_services_nlp_analyze_entities(
connection,
projects_id,
locations_id,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url(
"/v1beta1/projects/{projectsId}/locations/{locationsId}/services/nlp:analyzeEntities",
%{
"projectsId" => URI.encode(projects_id, &URI.char_unreserved?/1),
"locationsId" => URI.encode(locations_id, &URI.char_unreserved?/1)
}
)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.HealthCare.V1beta1.Model.AnalyzeEntitiesResponse{}]
)
end
end
| 52.809875 | 3,984 | 0.636037 |
9e8b07b4957e7875d0bfe128f80a97475f970510 | 319 | exs | Elixir | config/rpi3.exs | trarbr/nerves_livebook | ac5a5f7f8b80fb0c63cfe81e565c439e912973dc | [
"Apache-2.0"
] | 51 | 2021-09-21T12:23:41.000Z | 2022-03-31T08:37:17.000Z | config/rpi3.exs | trarbr/nerves_livebook | ac5a5f7f8b80fb0c63cfe81e565c439e912973dc | [
"Apache-2.0"
] | 37 | 2021-09-21T11:35:28.000Z | 2022-03-18T13:00:31.000Z | config/rpi3.exs | trarbr/nerves_livebook | ac5a5f7f8b80fb0c63cfe81e565c439e912973dc | [
"Apache-2.0"
] | 7 | 2021-09-26T22:33:35.000Z | 2022-02-20T10:59:29.000Z | import Config
# Configure the network using vintage_net
# See https://github.com/nerves-networking/vintage_net for more information
config :vintage_net,
config: [
{"eth0", %{type: VintageNetEthernet, ipv4: %{method: :dhcp}}},
{"wlan0", %{type: VintageNetWiFi}}
]
config :nerves_livebook, :ui, led: "led0"
| 26.583333 | 75 | 0.705329 |
9e8b08c596922cdf50030b6ec4ccfe8d49b68bec | 57,380 | ex | Elixir | lib/elixir/lib/kernel/special_forms.ex | basdirks/elixir | 2cb058ba32e410e8ea073970ef52d6476ef7b4d3 | [
"Apache-2.0"
] | 1 | 2018-08-08T12:15:48.000Z | 2018-08-08T12:15:48.000Z | lib/elixir/lib/kernel/special_forms.ex | basdirks/elixir | 2cb058ba32e410e8ea073970ef52d6476ef7b4d3 | [
"Apache-2.0"
] | null | null | null | lib/elixir/lib/kernel/special_forms.ex | basdirks/elixir | 2cb058ba32e410e8ea073970ef52d6476ef7b4d3 | [
"Apache-2.0"
] | null | null | null | defmodule Kernel.SpecialForms do
@moduledoc """
Special forms are the basic building blocks of Elixir, and therefore
cannot be overridden by the developer.
We define them in this module. Some of these forms are lexical (like
`alias/2`, `case/2`, etc). The macros `{}/1` and `<<>>/1` are also special
forms used to define tuple and binary data structures respectively.
This module also documents macros that return information about Elixir's
compilation environment, such as (`__ENV__/0`, `__MODULE__/0`, `__DIR__/0` and `__CALLER__/0`).
Finally, it also documents two special forms, `__block__/1` and
`__aliases__/1`, which are not intended to be called directly by the
developer but they appear in quoted contents since they are essential
in Elixir's constructs.
"""
defmacrop error!(args) do
quote do
_ = unquote(args)
message =
"Elixir's special forms are expanded by the compiler and must not be invoked directly"
:erlang.error(RuntimeError.exception(message))
end
end
@doc """
Creates a tuple.
More information about the tuple data type and about functions to manipulate
tuples can be found in the `Tuple` module; some functions for working with
tuples are also available in `Kernel` (such as `Kernel.elem/2` or
`Kernel.tuple_size/1`).
## AST representation
Only two-item tuples are considered literals in Elixir and return themselves
when quoted. Therefore, all other tuples are represented in the AST as calls to
the `:{}` special form.
iex> quote do
...> {1, 2}
...> end
{1, 2}
iex> quote do
...> {1, 2, 3}
...> end
{:{}, [], [1, 2, 3]}
"""
defmacro unquote(:{})(args), do: error!([args])
@doc """
Creates a map.
See the `Map` module for more information about maps, their syntax, and ways to
access and manipulate them.
## AST representation
Regardless of whether `=>` or the keyword syntax is used, key-value pairs in
maps are always represented internally as a list of two-element tuples for
simplicity:
iex> quote do
...> %{"a" => :b, c: :d}
...> end
{:%{}, [], [{"a", :b}, {:c, :d}]}
"""
defmacro unquote(:%{})(args), do: error!([args])
@doc """
Matches on or builds a struct.
A struct is a tagged map that allows developers to provide
default values for keys, tags to be used in polymorphic
dispatches and compile time assertions.
Structs are usually defined with the `Kernel.defstruct/1` macro:
defmodule User do
defstruct name: "john", age: 27
end
Now a struct can be created as follows:
%User{}
Underneath a struct is just a map with a `:__struct__` key
pointing to the `User` module:
%User{} == %{__struct__: User, name: "john", age: 27}
The struct fields can be given when building the struct:
%User{age: 31}
#=> %{__struct__: User, name: "john", age: 31}
Or also on pattern matching to extract values out:
%User{age: age} = user
An update operation specific for structs is also available:
%User{user | age: 28}
The advantage of structs is that they validate that the given
keys are part of the defined struct. The example below will fail
because there is no key `:full_name` in the `User` struct:
%User{full_name: "john doe"}
The syntax above will guarantee the given keys are valid at
compilation time and it will guarantee at runtime the given
argument is a struct, failing with `BadStructError` otherwise.
Although structs are maps, by default structs do not implement
any of the protocols implemented for maps. Check
`Kernel.defprotocol/2` for more information on how structs
can be used with protocols for polymorphic dispatch. Also
see `Kernel.struct/2` and `Kernel.struct!/2` for examples on
how to create and update structs dynamically.
## Pattern matching on struct names
Besides allowing pattern matching on struct fields, such as:
%User{age: age} = user
Structs also allow pattern matching on the struct name:
%struct_name{} = user
struct_name #=> User
You can also assign the struct name to `_` when you want to
check if something is a struct but you are not interested in
its name:
%_{} = user
"""
defmacro unquote(:%)(struct, map), do: error!([struct, map])
@doc """
Defines a new bitstring.
## Examples
iex> <<1, 2, 3>>
<<1, 2, 3>>
## Types
A bitstring is made of many segments and each segment has a
type. There are 9 types used in bitstrings:
- `integer`
- `float`
- `bits` (alias for `bitstring`)
- `bitstring`
- `binary`
- `bytes` (alias for `binary`)
- `utf8`
- `utf16`
- `utf32`
When no type is specified, the default is `integer`:
iex> <<1, 2, 3>>
<<1, 2, 3>>
Elixir also accepts by default the segment to be a literal
string or a literal charlist, which are by default expanded to integers:
iex> <<0, "foo">>
<<0, 102, 111, 111>>
Variables or any other type need to be explicitly tagged:
iex> rest = "oo"
iex> <<102, rest>>
** (ArgumentError) argument error
We can solve this by explicitly tagging it as `binary`:
iex> rest = "oo"
iex> <<102, rest::binary>>
"foo"
The `utf8`, `utf16`, and `utf32` types are for Unicode codepoints. They
can also be applied to literal strings and charlists:
iex> <<"foo"::utf16>>
<<0, 102, 0, 111, 0, 111>>
iex> <<"foo"::utf32>>
<<0, 0, 0, 102, 0, 0, 0, 111, 0, 0, 0, 111>>
## Options
Many options can be given by using `-` as separator. Order is
arbitrary, so the following are all equivalent:
<<102::integer-native, rest::binary>>
<<102::native-integer, rest::binary>>
<<102::unsigned-big-integer, rest::binary>>
<<102::unsigned-big-integer-size(8), rest::binary>>
<<102::unsigned-big-integer-8, rest::binary>>
<<102::8-integer-big-unsigned, rest::binary>>
<<102, rest::binary>>
### Unit and Size
The length of the match is equal to the `unit` (a number of bits) times the
`size` (the number of repeated segments of length `unit`).
Type | Default Unit
--------- | ------------
`integer` | 1 bit
`float` | 1 bit
`binary` | 8 bits
Sizes for types are a bit more nuanced. The default size for integers is 8.
For floats, it is 64. For floats, `size * unit` must result in 32 or 64,
corresponding to [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point)
binary32 and binary64, respectively.
For binaries, the default is the size of the binary. Only the last binary in a
match can use the default size. All others must have their size specified
explicitly, even if the match is unambiguous. For example:
iex> <<name::binary-size(5), " the ", species::binary>> = <<"Frank the Walrus">>
"Frank the Walrus"
iex> {name, species}
{"Frank", "Walrus"}
Failing to specify the size for the non-last causes compilation to fail:
<<name::binary, " the ", species::binary>> = <<"Frank the Walrus">>
** (CompileError): a binary field without size is only allowed at the end of a binary pattern
#### Shortcut Syntax
Size and unit can also be specified using a syntax shortcut
when passing integer values:
iex> x = 1
iex> <<x::8>> == <<x::size(8)>>
true
iex> <<x::8*4>> == <<x::size(8)-unit(4)>>
true
This syntax reflects the fact the effective size is given by
multiplying the size by the unit.
### Modifiers
Some types have associated modifiers to clear up ambiguity in byte
representation.
Modifier | Relevant Type(s)
-------------------- | ----------------
`signed` | `integer`
`unsigned` (default) | `integer`
`little` | `integer`, `float`, `utf16`, `utf32`
`big` (default) | `integer`, `float`, `utf16`, `utf32`
`native` | `integer`, `utf16`, `utf32`
### Sign
Integers can be `signed` or `unsigned`, defaulting to `unsigned`.
iex> <<int::integer>> = <<-100>>
<<156>>
iex> int
156
iex> <<int::integer-signed>> = <<-100>>
<<156>>
iex> int
-100
`signed` and `unsigned` are only used for matching binaries (see below) and
are only used for integers.
iex> <<-100::signed, _rest::binary>> = <<-100, "foo">>
<<156, 102, 111, 111>>
### Endianness
Elixir has three options for endianness: `big`, `little`, and `native`.
The default is `big`:
iex> <<number::little-integer-size(16)>> = <<0, 1>>
<<0, 1>>
iex> number
256
iex> <<number::big-integer-size(16)>> = <<0, 1>>
<<0, 1>>
iex> number
1
`native` is determined by the VM at startup and will depend on the
host operating system.
## Binary/Bitstring Matching
Binary matching is a powerful feature in Elixir that is useful for extracting
information from binaries as well as pattern matching.
Binary matching can be used by itself to extract information from binaries:
iex> <<"Hello, ", place::binary>> = "Hello, World"
"Hello, World"
iex> place
"World"
Or as a part of function definitions to pattern match:
defmodule ImageTyper do
@png_signature <<137::size(8), 80::size(8), 78::size(8), 71::size(8),
13::size(8), 10::size(8), 26::size(8), 10::size(8)>>
@jpg_signature <<255::size(8), 216::size(8)>>
def type(<<@png_signature, rest::binary>>), do: :png
def type(<<@jpg_signature, rest::binary>>), do: :jpg
def type(_), do :unknown
end
### Performance & Optimizations
The Erlang compiler can provide a number of optimizations on binary creation
and matching. To see optimization output, set the `bin_opt_info` compiler
option:
ERL_COMPILER_OPTIONS=bin_opt_info mix compile
To learn more about specific optimizations and performance considerations,
check out
[Erlang's Efficiency Guide on handling binaries](http://www.erlang.org/doc/efficiency_guide/binaryhandling.html).
"""
defmacro unquote(:<<>>)(args), do: error!([args])
@doc """
Defines a remote call, a call to an anonymous function, or an alias.
The dot (`.`) in Elixir can be used for remote calls:
iex> String.downcase("FOO")
"foo"
In this example above, we have used `.` to invoke `downcase` in the
`String` module, passing `"FOO"` as argument.
The dot may be used to invoke anonymous functions too:
iex> (fn n -> n end).(7)
7
in which case there is a function on the left hand side.
We can also use the dot for creating aliases:
iex> Hello.World
Hello.World
This time, we have joined two aliases, defining the final alias
`Hello.World`.
## Syntax
The right side of `.` may be a word starting in upcase, which represents
an alias, a word starting with lowercase or underscore, any valid language
operator or any name wrapped in single- or double-quotes. Those are all valid
examples:
iex> Kernel.Sample
Kernel.Sample
iex> Kernel.length([1, 2, 3])
3
iex> Kernel.+(1, 2)
3
iex> Kernel."+"(1, 2)
3
Note that wrapping the function name in single- or double-quotes is always a
remote call. Therefore `Kernel."Foo"` will attempt to call the function "Foo"
and not return the alias `Kernel.Foo`. This is done by design as module names
are more strict than function names.
When the dot is used to invoke an anonymous function there is only one
operand, but it is still written using a postfix notation:
iex> negate = fn n -> -n end
iex> negate.(7)
-7
## Quoted expression
When `.` is used, the quoted expression may take two distinct
forms. When the right side starts with a lowercase letter (or
underscore):
iex> quote do
...> String.downcase("FOO")
...> end
{{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], ["FOO"]}
Notice we have an inner tuple, containing the atom `:.` representing
the dot as first element:
{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}
This tuple follows the general quoted expression structure in Elixir,
with the name as first argument, some keyword list as metadata as second,
and the list of arguments as third. In this case, the arguments are the
alias `String` and the atom `:downcase`. The second argument in a remote call
is **always** an atom.
In the case of calls to anonymous functions, the inner tuple with the dot
special form has only one argument, reflecting the fact that the operator is
unary:
iex> quote do
...> negate.(0)
...> end
{{:., [], [{:negate, [], __MODULE__}]}, [], [0]}
When the right side is an alias (i.e. starts with uppercase), we get instead:
iex> quote do
...> Hello.World
...> end
{:__aliases__, [alias: false], [:Hello, :World]}
We go into more details about aliases in the `__aliases__/1` special form
documentation.
## Unquoting
We can also use unquote to generate a remote call in a quoted expression:
iex> x = :downcase
iex> quote do
...> String.unquote(x)("FOO")
...> end
{{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], ["FOO"]}
Similar to `Kernel."FUNCTION_NAME"`, `unquote(x)` will always generate a remote call,
independent of the value of `x`. To generate an alias via the quoted expression,
one needs to rely on `Module.concat/2`:
iex> x = Sample
iex> quote do
...> Module.concat(String, unquote(x))
...> end
{{:., [], [{:__aliases__, [alias: false], [:Module]}, :concat]}, [],
[{:__aliases__, [alias: false], [:String]}, Sample]}
"""
defmacro unquote(:.)(left, right), do: error!([left, right])
@doc """
`alias/2` is used to setup aliases, often useful with modules names.
## Examples
`alias/2` can be used to setup an alias for any module:
defmodule Math do
alias MyKeyword, as: Keyword
end
In the example above, we have set up `MyKeyword` to be aliased
as `Keyword`. So now, any reference to `Keyword` will be
automatically replaced by `MyKeyword`.
In case one wants to access the original `Keyword`, it can be done
by accessing `Elixir`:
Keyword.values #=> uses MyKeyword.values
Elixir.Keyword.values #=> uses Keyword.values
Notice that calling `alias` without the `as:` option automatically
sets an alias based on the last part of the module. For example:
alias Foo.Bar.Baz
Is the same as:
alias Foo.Bar.Baz, as: Baz
We can also alias multiple modules in one line:
alias Foo.{Bar, Baz, Biz}
Is the same as:
alias Foo.Bar
alias Foo.Baz
alias Foo.Biz
## Lexical scope
`import/2`, `require/2` and `alias/2` are called directives and all
have lexical scope. This means you can set up aliases inside
specific functions and it won't affect the overall scope.
## Warnings
If you alias a module and you don't use the alias, Elixir is
going to issue a warning implying the alias is not being used.
In case the alias is generated automatically by a macro,
Elixir won't emit any warnings though, since the alias
was not explicitly defined.
Both warning behaviours could be changed by explicitly
setting the `:warn` option to `true` or `false`.
"""
defmacro alias(module, opts), do: error!([module, opts])
@doc """
Requires a module in order to use its macros.
## Examples
Public functions in modules are globally available, but in order to use
macros, you need to opt-in by requiring the module they are defined in.
Let's suppose you created your own `if/2` implementation in the module
`MyMacros`. If you want to invoke it, you need to first explicitly
require the `MyMacros`:
defmodule Math do
require MyMacros
MyMacros.if do_something, it_works
end
An attempt to call a macro that was not loaded will raise an error.
## Alias shortcut
`require/2` also accepts `as:` as an option so it automatically sets
up an alias. Please check `alias/2` for more information.
"""
defmacro require(module, opts), do: error!([module, opts])
@doc """
Imports functions and macros from other modules.
`import/2` allows one to easily access functions or macros from
others modules without using the qualified name.
## Examples
If you are using several functions from a given module, you can
import those functions and reference them as local functions,
for example:
iex> import List
iex> flatten([1, [2], 3])
[1, 2, 3]
## Selector
By default, Elixir imports functions and macros from the given
module, except the ones starting with underscore (which are
usually callbacks):
import List
A developer can filter to import only macros or functions via
the only option:
import List, only: :functions
import List, only: :macros
Alternatively, Elixir allows a developer to pass pairs of
name/arities to `:only` or `:except` as a fine grained control
on what to import (or not):
import List, only: [flatten: 1]
import String, except: [split: 2]
Notice that calling `except` is always exclusive on a previously
declared `import/2`. If there is no previous import, then it applies
to all functions and macros in the module. For example:
import List, only: [flatten: 1, keyfind: 4]
import List, except: [flatten: 1]
After the two import calls above, only `List.keyfind/4` will be
imported.
## Underscore functions
By default functions starting with `_` are not imported. If you really want
to import a function starting with `_` you must explicitly include it in the
`:only` selector.
import File.Stream, only: [__build__: 3]
## Lexical scope
It is important to notice that `import/2` is lexical. This means you
can import specific macros inside specific functions:
defmodule Math do
def some_function do
# 1) Disable "if/2" from Kernel
import Kernel, except: [if: 2]
# 2) Require the new "if/2" macro from MyMacros
import MyMacros
# 3) Use the new macro
if do_something, it_works
end
end
In the example above, we imported macros from `MyMacros`,
replacing the original `if/2` implementation by our own
within that specific function. All other functions in that
module will still be able to use the original one.
## Warnings
If you import a module and you don't use any of the imported
functions or macros from this module, Elixir is going to issue
a warning implying the import is not being used.
In case the import is generated automatically by a macro,
Elixir won't emit any warnings though, since the import
was not explicitly defined.
Both warning behaviours could be changed by explicitly
setting the `:warn` option to `true` or `false`.
## Ambiguous function/macro names
If two modules `A` and `B` are imported and they both contain
a `foo` function with an arity of `1`, an error is only emitted
if an ambiguous call to `foo/1` is actually made; that is, the
errors are emitted lazily, not eagerly.
"""
defmacro import(module, opts), do: error!([module, opts])
@doc """
Returns the current environment information as a `Macro.Env` struct.
In the environment you can access the current filename,
line numbers, set up aliases, the current function and others.
"""
defmacro __ENV__, do: error!([])
@doc """
Returns the current module name as an atom or `nil` otherwise.
Although the module can be accessed in the `__ENV__/0`, this macro
is a convenient shortcut.
"""
defmacro __MODULE__, do: error!([])
@doc """
Returns the absolute path of the directory of the current file as a binary.
Although the directory can be accessed as `Path.dirname(__ENV__.file)`,
this macro is a convenient shortcut.
"""
defmacro __DIR__, do: error!([])
@doc """
Returns the current calling environment as a `Macro.Env` struct.
In the environment you can access the filename, line numbers,
set up aliases, the function and others.
"""
defmacro __CALLER__, do: error!([])
@doc """
Returns the stacktrace for the currently handled exception.
It is available only in the `catch` and `rescue` clauses of `try/1`
expressions.
"""
defmacro __STACKTRACE__, do: error!([])
@doc """
Accesses an already bound variable in match clauses. Also known as the pin operator.
## Examples
Elixir allows variables to be rebound via static single assignment:
iex> x = 1
iex> x = x + 1
iex> x
2
However, in some situations, it is useful to match against an existing
value, instead of rebinding. This can be done with the `^` special form,
colloquially known as the pin operator:
iex> x = 1
iex> ^x = List.first([1])
iex> ^x = List.first([2])
** (MatchError) no match of right hand side value: 2
Note that `^x` always refers to the value of `x` prior to the match. The
following example will match:
iex> x = 0
iex> {x, ^x} = {1, 0}
iex> x
1
"""
defmacro ^var, do: error!([var])
@doc """
Matches the value on the right against the pattern on the left.
"""
defmacro left = right, do: error!([left, right])
@doc """
Used by types and bitstrings to specify types.
This operator is used in two distinct occasions in Elixir.
It is used in typespecs to specify the type of a variable,
function or of a type itself:
@type number :: integer | float
@spec add(number, number) :: number
It may also be used in bit strings to specify the type
of a given bit segment:
<<int::integer-little, rest::bits>> = bits
Read the documentation on the `Typespec` page and
`<<>>/1` for more information on typespecs and
bitstrings respectively.
"""
defmacro left :: right, do: error!([left, right])
@doc ~S"""
Gets the representation of any expression.
## Examples
iex> quote do
...> sum(1, 2, 3)
...> end
{:sum, [], [1, 2, 3]}
## Explanation
Any Elixir code can be represented using Elixir data structures.
The building block of Elixir macros is a tuple with three elements,
for example:
{:sum, [], [1, 2, 3]}
The tuple above represents a function call to `sum` passing 1, 2 and
3 as arguments. The tuple elements are:
* The first element of the tuple is always an atom or
another tuple in the same representation.
* The second element of the tuple represents metadata.
* The third element of the tuple are the arguments for the
function call. The third argument may be an atom, which is
usually a variable (or a local call).
## Options
* `:unquote` - when `false`, disables unquoting. Useful when you have a quote
inside another quote and want to control what quote is able to unquote.
* `:location` - when set to `:keep`, keeps the current line and file from
quote. Read the Stacktrace information section below for more
information.
* `:line` - sets the quoted expressions to have the given line.
* `:generated` - marks the given chunk as generated so it does not emit warnings.
Currently it only works on special forms (for example, you can annotate a `case`
but not an `if`).
* `:context` - sets the resolution context.
* `:bind_quoted` - passes a binding to the macro. Whenever a binding is
given, `unquote/1` is automatically disabled.
## Quote literals
Besides the tuple described above, Elixir has a few literals that
when quoted return themselves. They are:
:sum #=> Atoms
1 #=> Integers
2.0 #=> Floats
[1, 2] #=> Lists
"strings" #=> Strings
{key, value} #=> Tuples with two elements
## Quote and macros
`quote/2` is commonly used with macros for code generation. As an exercise,
let's define a macro that multiplies a number by itself (squared). Note
there is no reason to define such as a macro (and it would actually be
seen as a bad practice), but it is simple enough that it allows us to focus
on the important aspects of quotes and macros:
defmodule Math do
defmacro squared(x) do
quote do
unquote(x) * unquote(x)
end
end
end
We can invoke it as:
import Math
IO.puts "Got #{squared(5)}"
At first, there is nothing in this example that actually reveals it is a
macro. But what is happening is that, at compilation time, `squared(5)`
becomes `5 * 5`. The argument `5` is duplicated in the produced code, we
can see this behaviour in practice though because our macro actually has
a bug:
import Math
my_number = fn ->
IO.puts "Returning 5"
5
end
IO.puts "Got #{squared(my_number.())}"
The example above will print:
Returning 5
Returning 5
Got 25
Notice how "Returning 5" was printed twice, instead of just once. This is
because a macro receives an expression and not a value (which is what we
would expect in a regular function). This means that:
squared(my_number.())
Actually expands to:
my_number.() * my_number.()
Which invokes the function twice, explaining why we get the printed value
twice! In the majority of the cases, this is actually unexpected behaviour,
and that's why one of the first things you need to keep in mind when it
comes to macros is to **not unquote the same value more than once**.
Let's fix our macro:
defmodule Math do
defmacro squared(x) do
quote do
x = unquote(x)
x * x
end
end
end
Now invoking `squared(my_number.())` as before will print the value just
once.
In fact, this pattern is so common that most of the times you will want
to use the `bind_quoted` option with `quote/2`:
defmodule Math do
defmacro squared(x) do
quote bind_quoted: [x: x] do
x * x
end
end
end
`:bind_quoted` will translate to the same code as the example above.
`:bind_quoted` can be used in many cases and is seen as good practice,
not only because it helps prevent us from running into common mistakes, but also
because it allows us to leverage other tools exposed by macros, such as
unquote fragments discussed in some sections below.
Before we finish this brief introduction, you will notice that, even though
we defined a variable `x` inside our quote:
quote do
x = unquote(x)
x * x
end
When we call:
import Math
squared(5)
x #=> ** (CompileError) undefined variable x or undefined function x/0
We can see that `x` did not leak to the user context. This happens
because Elixir macros are hygienic, a topic we will discuss at length
in the next sections as well.
## Hygiene in variables
Consider the following example:
defmodule Hygiene do
defmacro no_interference do
quote do
a = 1
end
end
end
require Hygiene
a = 10
Hygiene.no_interference
a #=> 10
In the example above, `a` returns 10 even if the macro
is apparently setting it to 1 because variables defined
in the macro do not affect the context the macro is executed in.
If you want to set or get a variable in the caller's context, you
can do it with the help of the `var!` macro:
defmodule NoHygiene do
defmacro interference do
quote do
var!(a) = 1
end
end
end
require NoHygiene
a = 10
NoHygiene.interference
a #=> 1
Note that you cannot even access variables defined in the same
module unless you explicitly give it a context:
defmodule Hygiene do
defmacro write do
quote do
a = 1
end
end
defmacro read do
quote do
a
end
end
end
Hygiene.write
Hygiene.read
#=> ** (RuntimeError) undefined variable a or undefined function a/0
For such, you can explicitly pass the current module scope as
argument:
defmodule ContextHygiene do
defmacro write do
quote do
var!(a, ContextHygiene) = 1
end
end
defmacro read do
quote do
var!(a, ContextHygiene)
end
end
end
ContextHygiene.write
ContextHygiene.read
#=> 1
## Hygiene in aliases
Aliases inside quote are hygienic by default.
Consider the following example:
defmodule Hygiene do
alias Map, as: M
defmacro no_interference do
quote do
M.new
end
end
end
require Hygiene
Hygiene.no_interference #=> %{}
Notice that, even though the alias `M` is not available
in the context the macro is expanded, the code above works
because `M` still expands to `Map`.
Similarly, even if we defined an alias with the same name
before invoking a macro, it won't affect the macro's result:
defmodule Hygiene do
alias Map, as: M
defmacro no_interference do
quote do
M.new
end
end
end
require Hygiene
alias SomethingElse, as: M
Hygiene.no_interference #=> %{}
In some cases, you want to access an alias or a module defined
in the caller. For such, you can use the `alias!` macro:
defmodule Hygiene do
# This will expand to Elixir.Nested.hello
defmacro no_interference do
quote do
Nested.hello
end
end
# This will expand to Nested.hello for
# whatever is Nested in the caller
defmacro interference do
quote do
alias!(Nested).hello
end
end
end
defmodule Parent do
defmodule Nested do
def hello, do: "world"
end
require Hygiene
Hygiene.no_interference
#=> ** (UndefinedFunctionError) ...
Hygiene.interference
#=> "world"
end
## Hygiene in imports
Similar to aliases, imports in Elixir are hygienic. Consider the
following code:
defmodule Hygiene do
defmacrop get_length do
quote do
length([1, 2, 3])
end
end
def return_length do
import Kernel, except: [length: 1]
get_length
end
end
Hygiene.return_length #=> 3
Notice how `Hygiene.return_length/0` returns `3` even though the `Kernel.length/1`
function is not imported. In fact, even if `return_length/0`
imported a function with the same name and arity from another
module, it wouldn't affect the function result:
def return_length do
import String, only: [length: 1]
get_length
end
Calling this new `return_length/0` will still return `3` as result.
Elixir is smart enough to delay the resolution to the latest
possible moment. So, if you call `length([1, 2, 3])` inside quote,
but no `length/1` function is available, it is then expanded in
the caller:
defmodule Lazy do
defmacrop get_length do
import Kernel, except: [length: 1]
quote do
length("hello")
end
end
def return_length do
import Kernel, except: [length: 1]
import String, only: [length: 1]
get_length
end
end
Lazy.return_length #=> 5
## Stacktrace information
When defining functions via macros, developers have the option of
choosing if runtime errors will be reported from the caller or from
inside the quote. Let's see an example:
# adder.ex
defmodule Adder do
@doc "Defines a function that adds two numbers"
defmacro defadd do
quote location: :keep do
def add(a, b), do: a + b
end
end
end
# sample.ex
defmodule Sample do
import Adder
defadd
end
require Sample
Sample.add(:one, :two)
#=> ** (ArithmeticError) bad argument in arithmetic expression
#=> adder.ex:5: Sample.add/2
When using `location: :keep` and invalid arguments are given to
`Sample.add/2`, the stacktrace information will point to the file
and line inside the quote. Without `location: :keep`, the error is
reported to where `defadd` was invoked. Note `location: :keep` affects
only definitions inside the quote.
## Binding and unquote fragments
Elixir quote/unquote mechanisms provides a functionality called
unquote fragments. Unquote fragments provide an easy way to generate
functions on the fly. Consider this example:
kv = [foo: 1, bar: 2]
Enum.each kv, fn {k, v} ->
def unquote(k)(), do: unquote(v)
end
In the example above, we have generated the functions `foo/0` and
`bar/0` dynamically. Now, imagine that, we want to convert this
functionality into a macro:
defmacro defkv(kv) do
Enum.map kv, fn {k, v} ->
quote do
def unquote(k)(), do: unquote(v)
end
end
end
We can invoke this macro as:
defkv [foo: 1, bar: 2]
However, we can't invoke it as follows:
kv = [foo: 1, bar: 2]
defkv kv
This is because the macro is expecting its arguments to be a
keyword list at **compilation** time. Since in the example above
we are passing the representation of the variable `kv`, our
code fails.
This is actually a common pitfall when developing macros. We are
assuming a particular shape in the macro. We can work around it
by unquoting the variable inside the quoted expression:
defmacro defkv(kv) do
quote do
Enum.each unquote(kv), fn {k, v} ->
def unquote(k)(), do: unquote(v)
end
end
end
If you try to run our new macro, you will notice it won't
even compile, complaining that the variables `k` and `v`
do not exist. This is because of the ambiguity: `unquote(k)`
can either be an unquote fragment, as previously, or a regular
unquote as in `unquote(kv)`.
One solution to this problem is to disable unquoting in the
macro, however, doing that would make it impossible to inject the
`kv` representation into the tree. That's when the `:bind_quoted`
option comes to the rescue (again!). By using `:bind_quoted`, we
can automatically disable unquoting while still injecting the
desired variables into the tree:
defmacro defkv(kv) do
quote bind_quoted: [kv: kv] do
Enum.each kv, fn {k, v} ->
def unquote(k)(), do: unquote(v)
end
end
end
In fact, the `:bind_quoted` option is recommended every time
one desires to inject a value into the quote.
"""
defmacro quote(opts, block), do: error!([opts, block])
@doc """
Unquotes the given expression from inside a macro.
## Examples
Imagine the situation you have a variable `value` and
you want to inject it inside some quote. The first attempt
would be:
value = 13
quote do
sum(1, value, 3)
end
Which would then return:
{:sum, [], [1, {:value, [], quoted}, 3]}
Which is not the expected result. For this, we use unquote:
iex> value = 13
iex> quote do
...> sum(1, unquote(value), 3)
...> end
{:sum, [], [1, 13, 3]}
"""
defmacro unquote(:unquote)(expr), do: error!([expr])
@doc """
Unquotes the given list expanding its arguments. Similar
to `unquote/1`.
## Examples
iex> values = [2, 3, 4]
iex> quote do
...> sum(1, unquote_splicing(values), 5)
...> end
{:sum, [], [1, 2, 3, 4, 5]}
"""
defmacro unquote(:unquote_splicing)(expr), do: error!([expr])
@doc ~S"""
Comprehensions allow you to quickly build a data structure from
an enumerable or a bitstring.
Let's start with an example:
iex> for n <- [1, 2, 3, 4], do: n * 2
[2, 4, 6, 8]
A comprehension accepts many generators and filters. Enumerable
generators are defined using `<-`:
# A list generator:
iex> for n <- [1, 2, 3, 4], do: n * 2
[2, 4, 6, 8]
# A comprehension with two generators
iex> for x <- [1, 2], y <- [2, 3], do: x * y
[2, 3, 4, 6]
Filters can also be given:
# A comprehension with a generator and a filter
iex> for n <- [1, 2, 3, 4, 5, 6], rem(n, 2) == 0, do: n
[2, 4, 6]
Note generators can also be used to filter as it removes any value
that doesn't match the pattern on the left side of `<-`:
iex> users = [user: "john", admin: "meg", guest: "barbara"]
iex> for {type, name} when type != :guest <- users do
...> String.upcase(name)
...> end
["JOHN", "MEG"]
Bitstring generators are also supported and are very useful when you
need to organize bitstring streams:
iex> pixels = <<213, 45, 132, 64, 76, 32, 76, 0, 0, 234, 32, 15>>
iex> for <<r::8, g::8, b::8 <- pixels>>, do: {r, g, b}
[{213, 45, 132}, {64, 76, 32}, {76, 0, 0}, {234, 32, 15}]
Variable assignments inside the comprehension, be it in generators,
filters or inside the block, are not reflected outside of the
comprehension.
## Into
In the examples above, the result returned by the comprehension was
always a list. The returned result can be configured by passing an
`:into` option, that accepts any structure as long as it implements
the `Collectable` protocol.
For example, we can use bitstring generators with the `:into` option
to easily remove all spaces in a string:
iex> for <<c <- " hello world ">>, c != ?\s, into: "", do: <<c>>
"helloworld"
The `IO` module provides streams, that are both `Enumerable` and
`Collectable`, here is an upcase echo server using comprehensions:
for line <- IO.stream(:stdio, :line), into: IO.stream(:stdio, :line) do
String.upcase(line)
end
## Uniq
`uniq: true` can also be given to comprehensions to guarantee that
that results are only added to the collection if they were not returned
before. For example:
iex> for(x <- [1, 1, 2, 3], uniq: true, do: x * 2)
[2, 4, 6]
iex> for(<<x <- "abcabc">>, uniq: true, into: "", do: <<x - 32>>)
"ABC"
"""
defmacro for(args), do: error!([args])
@doc """
Used to combine matching clauses.
Let's start with an example:
iex> opts = %{width: 10, height: 15}
iex> with {:ok, width} <- Map.fetch(opts, :width),
...> {:ok, height} <- Map.fetch(opts, :height) do
...> {:ok, width * height}
...> end
{:ok, 150}
If all clauses match, the `do` block is executed, returning its result.
Otherwise the chain is aborted and the non-matched value is returned:
iex> opts = %{width: 10}
iex> with {:ok, width} <- Map.fetch(opts, :width),
...> {:ok, height} <- Map.fetch(opts, :height) do
...> {:ok, width * height}
...> end
:error
Guards can be used in patterns as well:
iex> users = %{"melany" => "guest", "bob" => :admin}
iex> with {:ok, role} when not is_binary(role) <- Map.fetch(users, "bob") do
...> {:ok, to_string(role)}
...> end
{:ok, "admin"}
As in `for/1`, variables bound inside `with/1` won't leak;
"bare expressions" may also be inserted between the clauses:
iex> width = nil
iex> opts = %{width: 10, height: 15}
iex> with {:ok, width} <- Map.fetch(opts, :width),
...> double_width = width * 2,
...> {:ok, height} <- Map.fetch(opts, :height) do
...> {:ok, double_width * height}
...> end
{:ok, 300}
iex> width
nil
Note that if a "bare expression" fails to match, it will raise a `MatchError`
instead of returning the non-matched value:
with :foo = :bar, do: :ok
#=> ** (MatchError) no match of right hand side value: :bar
As with any other function or macro call in Elixir, explicit parens can
also be used around the arguments before the `do`/`end` block:
iex> opts = %{width: 10, height: 15}
iex> with(
...> {:ok, width} <- Map.fetch(opts, :width),
...> {:ok, height} <- Map.fetch(opts, :height)
...> ) do
...> {:ok, width * height}
...> end
{:ok, 150}
The choice between parens and no parens is a matter of preference.
An `else` option can be given to modify what is being returned from
`with` in the case of a failed match:
iex> opts = %{width: 10}
iex> with {:ok, width} <- Map.fetch(opts, :width),
...> {:ok, height} <- Map.fetch(opts, :height) do
...> {:ok, width * height}
...> else
...> :error ->
...> {:error, :wrong_data}
...> end
{:error, :wrong_data}
If there is no matching `else` condition, then a `WithClauseError` exception is raised.
"""
defmacro with(args), do: error!([args])
@doc """
Defines an anonymous function.
## Examples
iex> add = fn a, b -> a + b end
iex> add.(1, 2)
3
Anonymous functions can also have multiple clauses. All clauses
should expect the same number of arguments:
iex> negate = fn
...> true -> false
...> false -> true
...> end
iex> negate.(false)
true
"""
defmacro unquote(:fn)(clauses), do: error!([clauses])
@doc """
Internal special form for block expressions.
This is the special form used whenever we have a block
of expressions in Elixir. This special form is private
and should not be invoked directly:
iex> quote do
...> 1
...> 2
...> 3
...> end
{:__block__, [], [1, 2, 3]}
"""
defmacro unquote(:__block__)(args), do: error!([args])
@doc """
Captures or creates an anonymous function.
## Capture
The capture operator is most commonly used to capture a
function with given name and arity from a module:
iex> fun = &Kernel.is_atom/1
iex> fun.(:atom)
true
iex> fun.("string")
false
In the example above, we captured `Kernel.is_atom/1` as an
anonymous function and then invoked it.
The capture operator can also be used to capture local functions,
including private ones, and imported functions by omitting the
module name:
&local_function/1
## Anonymous functions
The capture operator can also be used to partially apply
functions, where `&1`, `&2` and so on can be used as value
placeholders. For example:
iex> double = &(&1 * 2)
iex> double.(2)
4
In other words, `&(&1 * 2)` is equivalent to `fn x -> x * 2 end`.
We can partially apply a remote function with placeholder:
iex> take_five = &Enum.take(&1, 5)
iex> take_five.(1..10)
[1, 2, 3, 4, 5]
Another example while using an imported or local function:
iex> first_elem = &elem(&1, 0)
iex> first_elem.({0, 1})
0
The `&` operator can be used with more complex expressions:
iex> fun = &(&1 + &2 + &3)
iex> fun.(1, 2, 3)
6
As well as with lists and tuples:
iex> fun = &{&1, &2}
iex> fun.(1, 2)
{1, 2}
iex> fun = &[&1 | &2]
iex> fun.(1, [2, 3])
[1, 2, 3]
The only restrictions when creating anonymous functions is that at
least one placeholder must be present, i.e. it must contain at least
`&1`, and that block expressions are not supported:
# No placeholder, fails to compile.
&(:foo)
# Block expression, fails to compile.
&(&1; &2)
"""
defmacro unquote(:&)(expr), do: error!([expr])
@doc """
Internal special form to hold aliases information.
It is usually compiled to an atom:
iex> quote do
...> Foo.Bar
...> end
{:__aliases__, [alias: false], [:Foo, :Bar]}
Elixir represents `Foo.Bar` as `__aliases__` so calls can be
unambiguously identified by the operator `:.`. For example:
iex> quote do
...> Foo.bar
...> end
{{:., [], [{:__aliases__, [alias: false], [:Foo]}, :bar]}, [], []}
Whenever an expression iterator sees a `:.` as the tuple key,
it can be sure that it represents a call and the second argument
in the list is an atom.
On the other hand, aliases holds some properties:
1. The head element of aliases can be any term that must expand to
an atom at compilation time.
2. The tail elements of aliases are guaranteed to always be atoms.
3. When the head element of aliases is the atom `:Elixir`, no expansion happens.
"""
defmacro unquote(:__aliases__)(args), do: error!([args])
@doc """
Calls the overridden function when overriding it with `Kernel.defoverridable/1`.
See `Kernel.defoverridable/1` for more information and documentation.
"""
defmacro super(args), do: error!([args])
@doc ~S"""
Matches the given expression against the given clauses.
## Examples
case thing do
{:selector, i, value} when is_integer(i) ->
value
value ->
value
end
In the example above, we match `thing` against each clause "head"
and execute the clause "body" corresponding to the first clause
that matches.
If no clause matches, an error is raised.
For this reason, it may be necessary to add a final catch-all clause (like `_`)
which will always match.
x = 10
case x do
0 ->
"This clause won't match"
_ ->
"This clause would match any value (x = #{x})"
end
#=> "This clause would match any value (x = 10)"
## Variables handling
Notice that variables bound in a clause "head" do not leak to the
outer context:
case data do
{:ok, value} -> value
:error -> nil
end
value #=> unbound variable value
However, variables explicitly bound in the clause "body" are
accessible from the outer context:
value = 7
case lucky? do
false -> value = 13
true -> true
end
value #=> 7 or 13
In the example above, value is going to be `7` or `13` depending on
the value of `lucky?`. In case `value` has no previous value before
case, clauses that do not explicitly bind a value have the variable
bound to `nil`.
If you want to pattern match against an existing variable,
you need to use the `^/1` operator:
x = 1
case 10 do
^x -> "Won't match"
_ -> "Will match"
end
#=> "Will match"
"""
defmacro case(condition, clauses), do: error!([condition, clauses])
@doc """
Evaluates the expression corresponding to the first clause that
evaluates to a truthy value.
cond do
hd([1, 2, 3]) ->
"1 is considered as true"
end
#=> "1 is considered as true"
Raises an error if all conditions evaluate to `nil` or `false`.
For this reason, it may be necessary to add a final always-truthy condition
(anything non-`false` and non-`nil`), which will always match.
## Examples
cond do
1 + 1 == 1 ->
"This will never match"
2 * 2 != 4 ->
"Nor this"
true ->
"This will"
end
#=> "This will"
"""
defmacro cond(clauses), do: error!([clauses])
@doc ~S"""
Evaluates the given expressions and handles any error, exit,
or throw that may have happened.
## Examples
try do
do_something_that_may_fail(some_arg)
rescue
ArgumentError ->
IO.puts "Invalid argument given"
catch
value ->
IO.puts "Caught #{inspect(value)}"
else
value ->
IO.puts "Success! The result was #{inspect(value)}"
after
IO.puts "This is printed regardless if it failed or succeed"
end
The `rescue` clause is used to handle exceptions while the `catch`
clause can be used to catch thrown values and exits.
The `else` clause can be used to control flow based on the result of
the expression. `catch`, `rescue`, and `else` clauses work based on
pattern matching (similar to the `case` special form).
Note that calls inside `try/1` are not tail recursive since the VM
needs to keep the stacktrace in case an exception happens. To
retrieve the stacktrace, access `__STACKTRACE__/0` inside the `rescue`
or `catch` clause.
## `rescue` clauses
Besides relying on pattern matching, `rescue` clauses provide some
conveniences around exceptions that allow one to rescue an
exception by its name. All the following formats are valid patterns
in `rescue` clauses:
# Rescue a single exception without binding the exception
# to a variable
try do
UndefinedModule.undefined_function
rescue
UndefinedFunctionError -> nil
end
# Rescue any of the given exception without binding
try do
UndefinedModule.undefined_function
rescue
[UndefinedFunctionError, ArgumentError] -> nil
end
# Rescue and bind the exception to the variable "x"
try do
UndefinedModule.undefined_function
rescue
x in [UndefinedFunctionError] -> nil
end
# Rescue all kinds of exceptions and bind the rescued exception
# to the variable "x"
try do
UndefinedModule.undefined_function
rescue
x -> nil
end
### Erlang errors
Erlang errors are transformed into Elixir ones when rescuing:
try do
:erlang.error(:badarg)
rescue
ArgumentError -> :ok
end
#=> :ok
The most common Erlang errors will be transformed into their
Elixir counterpart. Those which are not will be transformed
into the more generic `ErlangError`:
try do
:erlang.error(:unknown)
rescue
ErlangError -> :ok
end
#=> :ok
In fact, `ErlangError` can be used to rescue any error that is
not a proper Elixir error. For example, it can be used to rescue
the earlier `:badarg` error too, prior to transformation:
try do
:erlang.error(:badarg)
rescue
ErlangError -> :ok
end
#=> :ok
## `catch` clauses
The `catch` clause can be used to catch thrown values, exits, and errors.
### Catching thrown values
`catch` can be used to catch values thrown by `Kernel.throw/1`:
try do
throw(:some_value)
catch
thrown_value ->
IO.puts "A value was thrown: #{inspect(thrown_value)}"
end
### Catching values of any kind
The `catch` clause also supports catching exits and errors. To do that, it
allows matching on both the *kind* of the caught value as well as the value
itself:
try do
exit(:shutdown)
catch
:exit, value
IO.puts "Exited with value #{inspect(value)}"
end
try do
exit(:shutdown)
catch
kind, value when kind in [:exit, :throw] ->
IO.puts "Caught exit or throw with value #{inspect(value)}"
end
The `catch` clause also supports `:error` alongside `:exit` and `:throw` as
in Erlang, although this is commonly avoided in favor of `raise`/`rescue` control
mechanisms. One reason for this is that when catching `:error`, the error is
not automatically transformed into an Elixir error:
try do
:erlang.error(:badarg)
catch
:error, :badarg -> :ok
end
#=> :ok
## `after` clauses
An `after` clause allows you to define cleanup logic that will be invoked both
when the block of code passed to `try/1` succeeds and also when an error is raised. Note
that the process will exit as usual when receiving an exit signal that causes
it to exit abruptly and so the `after` clause is not guaranteed to be executed.
Luckily, most resources in Elixir (such as open files, ETS tables, ports, sockets,
and so on) are linked to or monitor the owning process and will automatically clean
themselves up if that process exits.
File.write!("tmp/story.txt", "Hello, World")
try do
do_something_with("tmp/story.txt")
after
File.rm("tmp/story.txt")
end
## `else` clauses
`else` clauses allow the result of the body passed to `try/1` to be pattern
matched on:
x = 2
try do
1 / x
rescue
ArithmeticError ->
:infinity
else
y when y < 1 and y > -1 ->
:small
_ ->
:large
end
If an `else` clause is not present and no exceptions are raised,
the result of the expression will be returned:
x = 1
^x =
try do
1 / x
rescue
ArithmeticError ->
:infinity
end
However, when an `else` clause is present but the result of the expression
does not match any of the patterns then an exception will be raised. This
exception will not be caught by a `catch` or `rescue` in the same `try`:
x = 1
try do
try do
1 / x
rescue
# The TryClauseError cannot be rescued here:
TryClauseError ->
:error_a
else
0 ->
:small
end
rescue
# The TryClauseError is rescued here:
TryClauseError ->
:error_b
end
Similarly, an exception inside an `else` clause is not caught or rescued
inside the same `try`:
try do
try do
nil
catch
# The exit(1) call below can not be caught here:
:exit, _ ->
:exit_a
else
_ ->
exit(1)
end
catch
# The exit is caught here:
:exit, _ ->
:exit_b
end
This means the VM no longer needs to keep the stacktrace once inside
an `else` clause and so tail recursion is possible when using a `try`
with a tail call as the final call inside an `else` clause. The same
is true for `rescue` and `catch` clauses.
Only the result of the tried expression falls down to the `else` clause.
If the `try` ends up in the `rescue` or `catch` clauses, their result
will not fall down to `else`:
try do
throw(:catch_this)
catch
:throw, :catch_this ->
:it_was_caught
else
# :it_was_caught will not fall down to this "else" clause.
other ->
{:else, other}
end
## Variable handling
Since an expression inside `try` may not have been evaluated
due to an exception, any variable created inside `try` cannot
be accessed externally. For instance:
try do
x = 1
do_something_that_may_fail(same_arg)
:ok
catch
_, _ -> :failed
end
x #=> unbound variable "x"
In the example above, `x` cannot be accessed since it was defined
inside the `try` clause. A common practice to address this issue
is to return the variables defined inside `try`:
x =
try do
x = 1
do_something_that_may_fail(same_arg)
x
catch
_, _ -> :failed
end
"""
defmacro try(args), do: error!([args])
@doc """
Checks if there is a message matching the given clauses
in the current process mailbox.
In case there is no such message, the current process hangs
until a message arrives or waits until a given timeout value.
## Examples
receive do
{:selector, number, name} when is_integer(number) ->
name
name when is_atom(name) ->
name
_ ->
IO.puts :stderr, "Unexpected message received"
end
An optional `after` clause can be given in case the message was not
received after the given timeout period, specified in milliseconds:
receive do
{:selector, number, name} when is_integer(number) ->
name
name when is_atom(name) ->
name
_ ->
IO.puts :stderr, "Unexpected message received"
after
5000 ->
IO.puts :stderr, "No message in 5 seconds"
end
The `after` clause can be specified even if there are no match clauses.
The timeout value given to `after` can be any expression evaluating to
one of the allowed values:
* `:infinity` - the process should wait indefinitely for a matching
message, this is the same as not using the after clause
* `0` - if there is no matching message in the mailbox, the timeout
will occur immediately
* positive integer smaller than or equal to `4_294_967_295` (`0xFFFFFFFF`
in hexadecimal notation) - it should be possible to represent the timeout
value as an unsigned 32-bit integer.
## Variables handling
The `receive/1` special form handles variables exactly as the `case/2`
special macro. For more information, check the docs for `case/2`.
"""
defmacro receive(args), do: error!([args])
end
| 28.072407 | 115 | 0.630254 |
9e8b1151b5e21cc5820f56abf5c61b43f60a012e | 1,488 | ex | Elixir | graphql/web/web.ex | leighshepperson/got-stats | 820e7aab68a0de39f55ed55fd18ca9e658a084ff | [
"MIT"
] | null | null | null | graphql/web/web.ex | leighshepperson/got-stats | 820e7aab68a0de39f55ed55fd18ca9e658a084ff | [
"MIT"
] | null | null | null | graphql/web/web.ex | leighshepperson/got-stats | 820e7aab68a0de39f55ed55fd18ca9e658a084ff | [
"MIT"
] | null | null | null | defmodule GOTStats.GraphQL.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use GOTStats.GraphQL.Web, :controller
use GOTStats.GraphQL.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused
on imports, uses and aliases.
Do NOT define functions inside the quoted expressions
below.
"""
def model do
quote do
# Define common model functionality
end
end
def controller do
quote do
use Phoenix.Controller, namespace: GOTStats.GraphQL
import GOTStats.GraphQL.Router.Helpers
import GOTStats.GraphQL.Gettext
end
end
def view do
quote do
use Phoenix.View, root: "web/templates", namespace: GOTStats.GraphQL
# Import convenience functions from controllers
import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1]
import GOTStats.GraphQL.Router.Helpers
import GOTStats.GraphQL.ErrorHelpers
import GOTStats.GraphQL.Gettext
end
end
def router do
quote do
use Phoenix.Router
end
end
def channel do
quote do
use Phoenix.Channel
import GOTStats.GraphQL.Gettext
end
end
@doc """
When used, dispatch to the appropriate controller/view/etc.
"""
defmacro __using__(which) when is_atom(which) do
apply(__MODULE__, which, [])
end
end
| 22.208955 | 88 | 0.696909 |
9e8b31de25ce1e2410fbc85671c26a9389ed8981 | 28,466 | exs | Elixir | lib/mix/test/mix/release_test.exs | ShPakvel/elixir | 75e5609364a2358f7eb475478ec8bdec98ddf07c | [
"Apache-2.0"
] | null | null | null | lib/mix/test/mix/release_test.exs | ShPakvel/elixir | 75e5609364a2358f7eb475478ec8bdec98ddf07c | [
"Apache-2.0"
] | null | null | null | lib/mix/test/mix/release_test.exs | ShPakvel/elixir | 75e5609364a2358f7eb475478ec8bdec98ddf07c | [
"Apache-2.0"
] | null | null | null | Code.require_file("../test_helper.exs", __DIR__)
defmodule Mix.ReleaseTest do
use MixTest.Case
import Mix.Release
doctest Mix.Release
_ = Application.ensure_started(:eex)
_ = Application.ensure_started(:runtime_tools)
@erts_version :erlang.system_info(:version)
@erts_source Path.join(:code.root_dir(), "erts-#{@erts_version}")
@elixir_version Application.spec(:elixir, :vsn)
@kernel_version Application.spec(:kernel, :vsn)
@runtime_tools_version Application.spec(:runtime_tools, :vsn)
@eex_ebin Application.app_dir(:eex, "ebin")
setup do
File.rm_rf!(tmp_path("mix_release"))
File.mkdir_p!(tmp_path("mix_release"))
:ok
end
describe "from_config!/3" do
test "uses default configuration if no release is specified" do
assert %Mix.Release{
name: :mix,
version: "0.1.0",
path: path,
version_path: version_path
} = from_config!(nil, config(), [])
assert String.ends_with?(path, "mix_release/_build/dev/rel/mix")
assert String.ends_with?(version_path, "mix_release/_build/dev/rel/mix/releases/0.1.0")
end
test "provides default options" do
release = from_config!(nil, config(), [])
assert release.options == [overwrite: false, quiet: false, strip_beams: true]
end
test "allows overrides" do
overrides = [path: "demo", version: "0.2.0", overwrite: true, quiet: true]
release = from_config!(nil, config(), overrides)
assert release.path == Path.absname("demo")
assert release.version == "0.2.0"
assert release.options[:overwrite]
assert release.options[:quiet]
end
test "allows specifying the version from an application" do
overrides = [version: {:from_app, :elixir}]
release = from_config!(nil, config(), overrides)
assert release.version == to_string(Application.spec(:elixir, :vsn))
end
test "raises when :from_app is used with an app that doesn't exist" do
overrides = [version: {:from_app, :not_valid}]
assert_raise Mix.Error,
~r"Could not find version for :not_valid, please make sure the application exists",
fn -> from_config!(nil, config(), overrides) end
end
test "includes applications" do
release = from_config!(nil, config(), [])
assert release.applications.mix[:path] == to_charlist(Application.app_dir(:mix))
refute release.applications.mix[:otp_app?]
assert release.applications.kernel[:path] == to_charlist(Application.app_dir(:kernel))
assert release.applications.kernel[:otp_app?]
end
test "allows release to be given as an anonymous function" do
release = from_config!(:foo, config(releases: [foo: fn -> [version: "0.2.0"] end]), [])
assert release.name == :foo
assert release.version == "0.2.0"
end
test "uses chosen release via the CLI" do
release =
from_config!(
:bar,
config(releases: [foo: [version: "0.2.0"], bar: [version: "0.3.0"]]),
[]
)
assert release.name == :bar
assert release.version == "0.3.0"
assert String.ends_with?(release.path, "mix_release/_build/dev/rel/bar")
assert String.ends_with?(
release.version_path,
"mix_release/_build/dev/rel/bar/releases/0.3.0"
)
end
test "uses chosen release via the default_release" do
release =
from_config!(
nil,
config(
default_release: :bar,
releases: [foo: [version: "0.2.0"], bar: [version: "0.3.0"]]
),
[]
)
assert release.name == :bar
assert release.version == "0.3.0"
assert String.ends_with?(release.path, "mix_release/_build/dev/rel/bar")
assert String.ends_with?(
release.version_path,
"mix_release/_build/dev/rel/bar/releases/0.3.0"
)
end
test "raises for multiple releases and no name" do
assert_raise Mix.Error,
~r"\"mix release\" was invoked without a name but there are multiple releases",
fn -> from_config!(nil, config(releases: [foo: [], bar: []]), []) end
end
test "raises for unknown release" do
assert_raise Mix.Error, "Unknown release :foo. The available releases are: []", fn ->
from_config!(:foo, config(), [])
end
end
test "uses the locked version of an app", context do
in_tmp(context.test, fn ->
# install newer version of the app in the custom erts
custom_erts_path = Path.join([File.cwd!(), "erts-#{@erts_version}"])
File.cp_r!(@erts_source, custom_erts_path)
ebin_dir = Path.expand(Path.join([custom_erts_path, "..", "lib", "cowboy-2.0.0", "ebin"]))
File.mkdir_p!(ebin_dir)
app_resource = "{application,cowboy,[{vsn,\"2.0.0\"},{modules,[]},{applications,[]}]}."
File.write!(Path.join(ebin_dir, "cowboy.app"), app_resource)
# install older version of the app in the project dependencies
project_path = Path.join(File.cwd!(), "project")
build_path = Path.join(project_path, "_build")
ebin_dir = Path.join([build_path, "dev", "lib", "cowboy", "ebin"])
File.mkdir_p!(ebin_dir)
app_resource = "{application,cowboy,[{vsn,\"1.1.2\"},{modules,[]},{applications,[]}]}."
File.write!(Path.join(ebin_dir, "cowboy.app"), app_resource)
File.mkdir_p!(Path.join([project_path, "deps", "cowboy"]))
lockfile = Path.join(project_path, "mix.lock")
File.write!(lockfile, ~S"""
%{
"cowboy": {:hex, :cowboy, "1.1.2"},
}
""")
app_config =
config(
deps: [{:cowboy, "~> 1.0", path: "deps/cowvoy"}],
releases: [demo: [include_erts: custom_erts_path, applications: [cowboy: :permanent]]]
)
Mix.Project.in_project(:mix, project_path, app_config, fn _ ->
Code.prepend_path(ebin_dir)
release = from_config!(nil, app_config, [])
assert release.applications.cowboy[:vsn] == '1.1.2'
end)
end)
end
test "uses the latest version of an app if it is not locked", context do
in_tmp(context.test, fn ->
test_erts_dir = Path.join(File.cwd!(), "erts-#{@erts_version}")
test_libs_dir = Path.join(File.cwd!(), "lib")
libs_dir = Path.join(:code.root_dir(), "lib")
libs = File.ls!(libs_dir)
File.cp_r!(@erts_source, test_erts_dir)
for lib <- libs,
source_file <- Path.wildcard(Path.join([libs_dir, lib, "ebin", "*.app"])) do
target_dir = Path.join([test_libs_dir, lib, "ebin"])
target_file = Path.join(target_dir, Path.basename(source_file))
File.mkdir_p!(target_dir)
File.cp!(source_file, target_file)
end
File.mkdir_p!(Path.join("lib", "compiler-1.0"))
release = from_config!(nil, config(releases: [demo: [include_erts: test_erts_dir]]), [])
assert Path.dirname(release.applications.compiler[:path]) == test_libs_dir
assert release.applications.compiler[:vsn] != "1.0"
end)
end
test "raises on unknown app" do
assert_raise Mix.Error, "Could not find application :unknown", fn ->
from_config!(nil, config(releases: [demo: [applications: [unknown: :none]]]), [])
end
end
test "raises for missing version" do
assert_raise Mix.Error, ~r"No :version found", fn ->
from_config!(nil, config() |> Keyword.drop([:version]), [])
end
end
test "raises for blank version" do
assert_raise Mix.Error, ~r"The release :version cannot be an empty string", fn ->
from_config!(nil, config(version: ""), [])
end
end
test "raises on invalid release names" do
assert_raise Mix.Error, ~r"Invalid release name", fn ->
from_config!(nil, config(releases: ["invalid name": []]), [])
end
end
test "raises on bad steps" do
assert_raise Mix.Error,
~r"The :steps option must be",
fn -> release(steps: :foo) end
assert_raise Mix.Error,
~r"The :steps option must contain the atom :assemble once, got: \[\]",
fn -> release(steps: []) end
assert_raise Mix.Error,
~r"The :steps option must contain the atom :assemble once",
fn -> release(steps: [:assemble, :assemble]) end
assert_raise Mix.Error,
~r"The :tar step must come after :assemble",
fn -> release(steps: [:tar, :assemble]) end
assert_raise Mix.Error,
~r"The :steps option can only contain the atom :tar once",
fn -> release(steps: [:assemble, :tar, :tar]) end
assert_raise Mix.Error,
~r"The :steps option must be",
fn -> release(steps: [:foo]) end
end
end
describe "from_config!/3 + umbrella" do
test "cannot infer for umbrella projects" do
assert_raise Mix.Error,
~r"Umbrella projects require releases to be explicitly defined",
fn -> from_config!(nil, config(apps_path: "apps"), []) end
end
test "requires apps for umbrella projects" do
assert_raise Mix.Error,
~r"Umbrella projects require releases to be explicitly defined",
fn -> from_config!(nil, config(apps_path: "apps", releases: [foo: []]), []) end
end
test "builds explicit releases with applications" do
config = config(apps_path: "apps", releases: [foo: [applications: [mix: :permanent]]])
assert %Mix.Release{
name: :foo,
version: "0.1.0",
path: _path,
version_path: _version_path
} = from_config!(nil, config, [])
end
end
describe "from_config!/3 + boot_scripts" do
test "generates a start boot script with current application" do
release = release([])
assert release.boot_scripts.start == [
kernel: :permanent,
stdlib: :permanent,
elixir: :permanent,
sasl: :permanent,
mix: :permanent,
iex: :none,
compiler: :permanent
]
end
test "includes extra application in order" do
# Current app is always last
release = release(applications: [eex: :permanent])
assert release.boot_scripts.start == [
kernel: :permanent,
stdlib: :permanent,
elixir: :permanent,
sasl: :permanent,
eex: :permanent,
mix: :permanent,
iex: :none,
compiler: :permanent
]
# Unless explicitly given
release = release(applications: [mix: :permanent, eex: :permanent])
assert release.boot_scripts.start == [
kernel: :permanent,
stdlib: :permanent,
elixir: :permanent,
sasl: :permanent,
mix: :permanent,
eex: :permanent,
iex: :none,
compiler: :permanent
]
end
test "configures other applications" do
release = release(applications: [mix: :temporary])
assert release.boot_scripts.start[:mix] == :temporary
release = release(applications: [iex: :temporary])
assert release.boot_scripts.start[:iex] == :temporary
end
test "generates a start_clean script with only kernel and stdlib starting up" do
release = release([])
assert release.boot_scripts.start_clean == [
kernel: :permanent,
stdlib: :permanent,
elixir: :none,
sasl: :none,
mix: :none,
iex: :none,
compiler: :none
]
end
end
describe "from_config!/3 + include_erts" do
test "when true (default)" do
release = release([])
assert release.erts_version == @erts_version
assert release.erts_source == to_charlist(@erts_source)
end
test "when false" do
release = release(include_erts: false)
assert release.erts_version == @erts_version
assert release.erts_source == nil
end
test "when anonymous function" do
release = release(include_erts: fn -> true end)
assert release.erts_version == @erts_version
assert release.erts_source == to_charlist(@erts_source)
release = release(include_erts: fn -> false end)
assert release.erts_version == @erts_version
assert release.erts_source == nil
end
test "with valid path" do
release = release(include_erts: @erts_source)
assert release.erts_version == @erts_version
assert release.erts_source == to_charlist(@erts_source)
end
test "with invalid path" do
assert_raise Mix.Error, "Could not find ERTS system at \"bad\"", fn ->
release(include_erts: "bad")
end
end
end
describe "make_boot_script/4" do
@boot_script_path tmp_path("mix_release/start")
test "writes .rel, .boot, and .script files" do
release = release([])
assert make_boot_script(release, @boot_script_path, release.boot_scripts.start) == :ok
assert {:ok,
[
{:release, {'demo', '0.1.0'}, {:erts, @erts_version},
[
{:kernel, _, :permanent},
{:stdlib, _, :permanent},
{:elixir, @elixir_version, :permanent},
{:sasl, _, :permanent},
{:mix, @elixir_version, :permanent},
{:iex, @elixir_version, :none},
{:compiler, _, :permanent}
]}
]} = :file.consult(@boot_script_path <> ".rel")
assert {:ok, [{:script, {'demo', '0.1.0'}, instructions}]} =
:file.consult(@boot_script_path <> ".script")
assert {:path, ['$ROOT/lib/kernel-#{@kernel_version}/ebin']} in instructions
assert {:path, ['$RELEASE_LIB/elixir-#{@elixir_version}/ebin']} in instructions
assert File.read!(@boot_script_path <> ".boot") |> :erlang.binary_to_term() ==
{:script, {'demo', '0.1.0'}, instructions}
end
test "prepends relevant paths" do
release = release([])
assert make_boot_script(
release,
@boot_script_path,
release.boot_scripts.start,
["$RELEASE_LIB/sample"]
) == :ok
assert {:ok, [{:script, {'demo', '0.1.0'}, instructions}]} =
:file.consult(@boot_script_path <> ".script")
assert {:path, ['$ROOT/lib/kernel-#{@kernel_version}/ebin']} in instructions
refute {:path, ['$RELEASE_LIB/elixir-#{@elixir_version}/ebin']} in instructions
assert {:path, ['$RELEASE_LIB/sample', '$RELEASE_LIB/elixir-#{@elixir_version}/ebin']} in instructions
assert File.read!(@boot_script_path <> ".boot") |> :erlang.binary_to_term() ==
{:script, {'demo', '0.1.0'}, instructions}
end
test "works when :load/:none is set at the leaf" do
release = release(applications: [mix: :none])
assert make_boot_script(release, @boot_script_path, release.boot_scripts.start) == :ok
{:ok, [{:release, _, _, rel_apps}]} = :file.consult(@boot_script_path <> ".rel")
assert List.keyfind(rel_apps, :mix, 0) == {:mix, @elixir_version, :none}
end
test "works when :load/:none is set at the subtree" do
release = release(applications: [mix: :load, elixir: :load, iex: :load])
assert make_boot_script(release, @boot_script_path, release.boot_scripts.start) == :ok
{:ok, [{:release, _, _, rel_apps}]} = :file.consult(@boot_script_path <> ".rel")
assert {:elixir, _, :load} = List.keyfind(rel_apps, :elixir, 0)
assert {:iex, _, :load} = List.keyfind(rel_apps, :iex, 0)
assert {:mix, _, :load} = List.keyfind(rel_apps, :mix, 0)
end
test "raises on unknown app" do
{:error, message} = make_boot_script(release([]), @boot_script_path, unknown: :permanent)
assert message =~ "Unknown application :unknown"
end
test "raises on missing dependency" do
{:error, message} = make_boot_script(release([]), @boot_script_path, elixir: :permanent)
assert message =~
"Application :elixir is listed in the release boot, but it depends on :kernel, which isn't"
end
test "raises on unknown mode" do
{:error, message} = make_boot_script(release([]), @boot_script_path, mix: :what)
assert message =~ "Unknown mode :what for :mix"
end
test "raises on bad load/none" do
release = release(applications: [kernel: :load])
{:error, message} = make_boot_script(release, @boot_script_path, release.boot_scripts.start)
assert message =~
"Application :stdlib has mode :permanent but it depends on :kernel which is set to :load"
release = release(applications: [elixir: :none])
{:error, message} = make_boot_script(release, @boot_script_path, release.boot_scripts.start)
assert message =~
"Application :mix has mode :permanent but it depends on :elixir which is set to :none"
end
end
describe "make_cookie/1" do
@cookie_path tmp_path("mix_release/cookie")
test "creates a random cookie if no cookie" do
assert make_cookie(release([]), @cookie_path) == :ok
assert byte_size(File.read!(@cookie_path)) == 56
end
test "uses the given cookie" do
release = release(cookie: "abcdefghijk")
assert make_cookie(release, @cookie_path) == :ok
assert File.read!(@cookie_path) == "abcdefghijk"
assert make_cookie(release, @cookie_path) == :ok
end
test "asks to change if the cookie changes" do
assert make_cookie(release(cookie: "abcdefghijk"), @cookie_path) == :ok
send(self(), {:mix_shell_input, :yes?, false})
assert make_cookie(release(cookie: "lmnopqrstuv"), @cookie_path) == :ok
assert File.read!(@cookie_path) == "abcdefghijk"
send(self(), {:mix_shell_input, :yes?, true})
assert make_cookie(release(cookie: "lmnopqrstuv"), @cookie_path) == :ok
assert File.read!(@cookie_path) == "lmnopqrstuv"
end
end
describe "make_start_erl/1" do
@start_erl_path tmp_path("mix_release/start_erl.data")
test "writes erts and release versions" do
assert make_start_erl(release([]), @start_erl_path) == :ok
assert File.read!(@start_erl_path) == "#{@erts_version} 0.1.0"
end
end
describe "make_sys_config/1" do
@sys_config tmp_path("mix_release/_build/dev/rel/demo/releases/0.1.0/sys.config")
@providers [{Config.Reader, "/foo/bar/baz"}]
test "writes the given sys_config" do
assert make_sys_config(release([]), [foo: [bar: :baz]], "unused/runtime/path") == :ok
contents = File.read!(@sys_config)
assert contents =~ "%% RUNTIME_CONFIG=false"
assert contents =~ "[{foo,[{bar,baz}]}]."
end
test "writes sys_config with encoding" do
assert make_sys_config(
release([]),
[encoding: {:time_μs, :"£", "£", '£'}],
"unused/runtime/path"
) ==
:ok
{:ok, contents} = :file.consult(@sys_config)
assert contents == [[encoding: {:time_μs, :"£", "£", '£'}]]
end
test "writes the given sys_config with config providers" do
release = release(config_providers: @providers)
assert make_sys_config(release, [kernel: [key: :value]], "/foo/bar/bat") == :ok
assert File.read!(@sys_config) =~ "%% RUNTIME_CONFIG=true"
{:ok, [config]} = :file.consult(@sys_config)
assert %Config.Provider{} = provider = config[:elixir][:config_provider_init]
refute provider.prune_after_boot
assert provider.extra_config == [kernel: [start_distribution: true]]
assert config[:kernel] == [key: :value, start_distribution: false]
end
test "writes the given sys_config without distribution and with pruning" do
release =
release(
config_providers: @providers,
start_distribution_during_config: true,
prune_runtime_sys_config_after_boot: true
)
assert make_sys_config(release, [kernel: [key: :value]], "/foo/bar/bat") == :ok
assert File.read!(@sys_config) =~ "%% RUNTIME_CONFIG=true"
{:ok, [config]} = :file.consult(@sys_config)
assert %Config.Provider{} = provider = config[:elixir][:config_provider_init]
assert provider.reboot_after_config
assert provider.prune_after_boot
assert provider.extra_config == []
assert config[:kernel] == [key: :value]
end
test "writes the given sys_config without reboot" do
release = release(config_providers: @providers, reboot_system_after_config: false)
assert make_sys_config(release, [kernel: [key: :value]], "/foo/bar/bat") == :ok
assert File.read!(@sys_config) =~ "%% RUNTIME_CONFIG=false"
{:ok, [config]} = :file.consult(@sys_config)
assert %Config.Provider{} = provider = config[:elixir][:config_provider_init]
refute provider.reboot_after_config
assert provider.extra_config == []
assert config[:kernel] == [key: :value]
end
test "errors on bad config" do
assert {:error, "Could not read configuration file." <> _} =
make_sys_config(release([]), [foo: self()], "unused/runtime/path")
end
end
describe "copy_erts/1" do
test "copies to directory" do
assert copy_erts(release(include_erts: true))
destination = tmp_path("mix_release/_build/dev/rel/demo/erts-#{@erts_version}")
assert File.exists?(destination)
assert File.read!(Path.join(destination, "bin/erl")) =~
~s|ROOTDIR="$(dirname "$(dirname "$BINDIR")")"|
refute File.exists?(Path.join(destination, "bin/erl.ini"))
refute File.exists?(Path.join(destination, "doc"))
# Now we copy from the copy using a string and without src
new_destination = tmp_path("mix_release/_build/dev/rel/new_demo/erts-#{@erts_version}")
File.rm_rf!(Path.join(destination, "src"))
release = from_config!(nil, config(releases: [new_demo: [include_erts: destination]]), [])
assert copy_erts(release)
assert File.exists?(new_destination)
end
test "does not copy when include_erts is false" do
refute copy_erts(release(include_erts: false))
destination = tmp_path("mix_release/_build/dev/rel/demo/erts-#{@erts_version}")
refute File.exists?(destination)
end
end
describe "copy_ebin/3" do
test "copies and strips beams" do
assert copy_ebin(release([]), @eex_ebin, tmp_path("eex_ebin"))
assert size!(Path.join(@eex_ebin, "eex.app")) ==
size!(tmp_path("eex_ebin/eex.app"))
assert size!(Path.join(@eex_ebin, "Elixir.EEx.beam")) >
size!(tmp_path("eex_ebin/Elixir.EEx.beam"))
end
test "copies without stripping beams" do
assert copy_ebin(release(strip_beams: false), @eex_ebin, tmp_path("eex_ebin"))
assert size!(Path.join(@eex_ebin, "eex.app")) ==
size!(tmp_path("eex_ebin/eex.app"))
assert size!(Path.join(@eex_ebin, "Elixir.EEx.beam")) ==
size!(tmp_path("eex_ebin/Elixir.EEx.beam"))
end
test "returns false for unknown or empty directories" do
source = tmp_path("mix_release")
refute copy_ebin(release([]), source, tmp_path("mix_release"))
File.mkdir_p!(source)
refute copy_ebin(release([]), source, tmp_path("mix_release"))
end
end
describe "copy_app/2" do
@release_lib tmp_path("mix_release/_build/dev/rel/demo/lib")
test "copies and strips beams" do
assert copy_app(release(applications: [eex: :permanent]), :eex)
assert size!(Path.join(@eex_ebin, "eex.app")) ==
size!(Path.join(@release_lib, "eex-#{@elixir_version}/ebin/eex.app"))
assert size!(Path.join(@eex_ebin, "Elixir.EEx.beam")) >
size!(Path.join(@release_lib, "eex-#{@elixir_version}/ebin/Elixir.EEx.beam"))
end
test "copies without stripping beams" do
assert copy_app(release(strip_beams: false, applications: [eex: :permanent]), :eex)
assert size!(Path.join(@eex_ebin, "eex.app")) ==
size!(Path.join(@release_lib, "eex-#{@elixir_version}/ebin/eex.app"))
assert size!(Path.join(@eex_ebin, "Elixir.EEx.beam")) ==
size!(Path.join(@release_lib, "eex-#{@elixir_version}/ebin/Elixir.EEx.beam"))
end
test "copies OTP apps" do
release = release(applications: [runtime_tools: :permanent])
assert copy_app(release, :runtime_tools)
assert File.exists?(Path.join(@release_lib, "runtime_tools-#{@runtime_tools_version}/ebin"))
assert File.exists?(Path.join(@release_lib, "runtime_tools-#{@runtime_tools_version}/priv"))
end
test "does not copy OTP app if include_erts is false" do
release = release(include_erts: false, applications: [runtime_tools: :permanent])
refute copy_app(release, :runtime_tools)
refute File.exists?(Path.join(@release_lib, "runtime_tools-#{@runtime_tools_version}/ebin"))
refute File.exists?(Path.join(@release_lib, "runtime_tools-#{@runtime_tools_version}/priv"))
end
end
describe "strip_beam/1" do
test "excludes at least docs and dbgi chunks" do
{:ok, beam} =
Path.join(@eex_ebin, "Elixir.EEx.beam")
|> File.read!()
|> strip_beam()
assert {:error, :beam_lib, {:missing_chunk, _, 'Dbgi'}} = :beam_lib.chunks(beam, ['Dbgi'])
assert {:error, :beam_lib, {:missing_chunk, _, 'Docs'}} = :beam_lib.chunks(beam, ['Docs'])
end
end
describe "included applications" do
test "are included in the release", context do
in_tmp(context.test, fn ->
app =
{:application, :my_sample1,
applications: [:kernel, :stdlib, :elixir],
description: 'my_sample1',
modules: [],
vsn: '1.0.0',
included_applications: [:runtime_tools]}
File.mkdir_p!("my_sample1/ebin")
Code.prepend_path("my_sample1/ebin")
format = :io_lib.format("%% coding: utf-8~n~p.~n", [app])
File.write!("my_sample1/ebin/my_sample1.app", format)
release = release(applications: [my_sample1: :permanent])
assert release.applications.runtime_tools[:included]
assert release.boot_scripts.start[:runtime_tools] == :load
release = release(applications: [my_sample1: :permanent, runtime_tools: :none])
assert release.applications.runtime_tools[:included]
assert release.boot_scripts.start[:runtime_tools] == :none
end)
end
test "raise on conflict", context do
in_tmp(context.test, fn ->
app =
{:application, :my_sample2,
applications: [:kernel, :stdlib, :elixir, :runtime_tools],
description: 'my_sample',
modules: [],
vsn: '1.0.0',
included_applications: [:runtime_tools]}
File.mkdir_p!("my_sample2/ebin")
Code.prepend_path("my_sample2/ebin")
format = :io_lib.format("%% coding: utf-8~n~p.~n", [app])
File.write!("my_sample2/ebin/my_sample2.app", format)
assert_raise Mix.Error,
":runtime_tools is listed both as a regular application and as an included application",
fn -> release(applications: [my_sample2: :permanent]) end
end)
end
end
defp size!(path) do
File.stat!(path).size
end
defp release(config) do
from_config!(nil, config(releases: [demo: config]), [])
end
defp config(extra \\ []) do
[
app: :mix,
version: "0.1.0",
build_path: tmp_path("mix_release/_build"),
build_per_environment: true,
config_path: tmp_path("mix_release/config/config.exs")
]
|> Keyword.merge(extra)
end
defmodule ReleaseApp do
def project do
[
app: :mix,
version: "0.1.0",
build_path: tmp_path("mix_release/_build"),
build_per_environment: true,
config_path: tmp_path("mix_release/config/config.exs")
]
|> Keyword.merge(Process.get(:project))
end
end
end
| 36.635779 | 109 | 0.608972 |
9e8b4346c12276c98705973f9df1082f80073e18 | 5,594 | ex | Elixir | lib/ex_ari/http/bridges.ex | rijavskii/ex_ari | 1fd5eabd9b4cb815e260867b0190a7fe635ee38a | [
"MIT"
] | 13 | 2020-04-17T16:48:00.000Z | 2022-03-25T19:16:51.000Z | lib/ex_ari/http/bridges.ex | rijavskii/ex_ari | 1fd5eabd9b4cb815e260867b0190a7fe635ee38a | [
"MIT"
] | 1 | 2020-04-02T12:18:59.000Z | 2020-04-02T12:18:59.000Z | lib/ex_ari/http/bridges.ex | rijavskii/ex_ari | 1fd5eabd9b4cb815e260867b0190a7fe635ee38a | [
"MIT"
] | 7 | 2020-04-28T19:45:50.000Z | 2022-03-25T21:42:03.000Z | defmodule ARI.HTTP.Bridges do
@moduledoc """
HTTP Interface for CRUD operations on Bridge Objects
REST Reference: https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Bridges+REST+API
Bridge Object: https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+REST+Data+Models#Asterisk16RESTDataModels-Bridge
"""
use ARI.HTTPClient, "/bridges"
alias ARI.HTTPClient.Response
@spec list :: Response.t()
def list do
GenServer.call(__MODULE__, :list)
end
@spec get(String.t()) :: Response.t()
def get(id) do
GenServer.call(__MODULE__, {:get, id})
end
@spec create(String.t(), String.t(), list()) :: Response.t()
def create(id, name, types \\ []) do
GenServer.call(__MODULE__, {:create, types, id, name})
end
@spec update(String.t(), String.t(), String.t()) :: Response.t()
def update(id, name, types) do
GenServer.call(__MODULE__, {:update, types, id, name})
end
@spec delete(String.t()) :: Response.t()
def delete(id) do
GenServer.call(__MODULE__, {:delete, id})
end
@spec add_channels(String.t(), list(), String.t()) :: Response.t()
def add_channels(id, channel_ids, role \\ "") do
GenServer.call(__MODULE__, {:add_channels, id, channel_ids, role})
end
@spec remove_channels(String.t(), list()) :: Response.t()
def remove_channels(id, channel_ids) do
GenServer.call(__MODULE__, {:remove_channels, id, channel_ids})
end
@spec set_video_source(String.t(), String.t()) :: Response.t()
def set_video_source(id, channel_id) do
GenServer.call(__MODULE__, {:set_video_source, id, channel_id})
end
@spec clear_video_source(String.t()) :: Response.t()
def clear_video_source(id) do
GenServer.call(__MODULE__, {:clear_video_source, id})
end
@spec start_moh(String.t(), String.t()) :: Response.t()
def start_moh(id, channel_id) do
GenServer.call(__MODULE__, {:start_moh, id, channel_id})
end
@spec stop_moh(String.t()) :: Response.t()
def stop_moh(id) do
GenServer.call(__MODULE__, {:stop_moh, id})
end
@spec play(String.t(), String.t(), String.t(), String.t(), integer(), integer()) ::
Response.t()
def play(id, playback_id, media, lang \\ "en", offsetms \\ 0, skipms \\ 3000) do
GenServer.call(__MODULE__, {:play, id, playback_id, media, lang, offsetms, skipms})
end
@spec record(
String.t(),
String.t(),
String.t(),
integer(),
integer(),
String.t(),
String.t(),
String.t()
) :: Response.t()
def record(
id,
name,
format,
max_duration \\ 0,
max_silence \\ 0,
if_exists \\ "fail",
beep \\ "no",
terminate_on \\ "#"
) do
GenServer.call(
__MODULE__,
{:record, id, name, format, max_duration, max_silence, if_exists, beep, terminate_on}
)
end
def handle_call(:list, from, state) do
{:noreply, request("GET", "", from, state)}
end
def handle_call({:get, id}, from, state) do
{:noreply, request("GET", "/#{id}", from, state)}
end
def handle_call({:delete, id}, from, state) do
{:noreply, request("DELETE", "/#{id}", from, state)}
end
def handle_call({:create, types, id, name}, from, state) do
{:noreply,
request(
"POST",
"?#{encode_params(%{type: Enum.join(types, ","), bridgeId: id, name: name})}",
from,
state
)}
end
def handle_call({:update, types, id, name}, from, state) do
{:noreply,
request(
"POST",
"/#{id}?#{encode_params(%{type: Enum.join(types, ","), name: name})}",
from,
state
)}
end
def handle_call({:add_channels, id, channel_ids, role}, from, state) do
{:noreply,
request(
"POST",
"/#{id}/addChannel?#{encode_params(%{channel: Enum.join(channel_ids, ","), role: role})}",
from,
state
)}
end
def handle_call({:remove_channels, id, channel_ids}, from, state) do
{:noreply,
request(
"POST",
"/#{id}/removeChannel?#{encode_params(%{channel: Enum.join(channel_ids, ",")})}",
from,
state
)}
end
def handle_call({:set_video_source, id, channel_id}, from, state) do
{:noreply, request("POST", "/#{id}/videoSource/#{channel_id}", from, state)}
end
def handle_call({:clear_video_source, id}, from, state) do
{:noreply, request("DELETE", "/#{id}/videoSource", from, state)}
end
def handle_call({:start_moh, id, channel_id}, from, state) do
{:noreply,
request("POST", "/#{id}/moh?#{encode_params(%{mohClass: channel_id})}", from, state)}
end
def handle_call({:stop_moh, id}, from, state) do
{:noreply, request("DELETE", "/#{id}/moh", from, state)}
end
def handle_call({:play, id, playback_id, media, lang, offsetms, skipms}, from, state) do
{:noreply,
request(
"POST",
"/#{id}/play/#{playback_id}?#{
encode_params(%{media: media, lang: lang, offsetms: offsetms, skipms: skipms})
}",
from,
state
)}
end
def handle_call(
{:record, id, name, format, max_duration, max_silence, if_exists, beep, terminate_on},
from,
state
) do
{:noreply,
request(
"POST",
"/#{id}/record?#{
encode_params(%{
name: name,
format: format,
maxDurationSeconds: max_duration,
maxSilenceSeconds: max_silence,
ifExists: if_exists,
beep: beep,
terminateOn: terminate_on
})
}",
from,
state
)}
end
end
| 27.421569 | 120 | 0.594744 |
9e8b60c4031e78693b67211821ec2644f63021be | 5,383 | exs | Elixir | test/plug_test.exs | cnavas88/exvalidate | 899127b5427ca1d4f926b8953c09ab6151365dda | [
"MIT"
] | 4 | 2020-04-23T09:44:01.000Z | 2020-10-29T17:02:29.000Z | test/plug_test.exs | cnavas88/exvalidate | 899127b5427ca1d4f926b8953c09ab6151365dda | [
"MIT"
] | 13 | 2020-04-23T09:39:28.000Z | 2020-11-05T15:59:25.000Z | test/plug_test.exs | cnavas88/exvalidate | 899127b5427ca1d4f926b8953c09ab6151365dda | [
"MIT"
] | 1 | 2019-10-21T13:10:09.000Z | 2019-10-21T13:10:09.000Z | defmodule Exvalidate.PlugTest do
use ExUnit.Case, async: true
use Plug.Test
alias Exvalidate.Plug, as: PlugValidate
alias Exvalidate.PlugError
defmodule TestRouterJson do
use Plug.Router
plug(Plug.Parsers, parsers: [:urlencoded, :multipart])
plug(:match)
plug(PlugValidate, on_error: &PlugError.json_error/2)
plug(:dispatch)
@schema [
id: [:required]
]
get "/test", private: %{validate_query: @schema} do
Plug.Conn.send_resp(conn, 200, "")
end
post "/test", private: %{validate_body: @schema} do
Plug.Conn.send_resp(conn, 200, "")
end
end
defmodule TestRouterPlainText do
use Plug.Router
plug(Plug.Parsers, parsers: [:urlencoded, :multipart])
plug(:match)
plug(PlugValidate, on_error: &PlugError.plain_error/2)
plug(:dispatch)
@schema [
id: [:required]
]
get "/test", private: %{validate_query: @schema} do
Plug.Conn.send_resp(conn, 200, "")
end
post "/test", private: %{validate_body: @schema} do
Plug.Conn.send_resp(conn, 200, "")
end
end
defmodule TestRouterCustomErrorFn do
use Plug.Router
plug(Plug.Parsers, parsers: [:urlencoded, :multipart])
plug(:match)
plug(PlugValidate, on_error: &Exvalidate.PlugTest.custom_error/2)
plug(:dispatch)
@schema [
id: [:required]
]
get "/test", private: %{validate_query: @schema} do
Plug.Conn.send_resp(conn, 200, "")
end
post "/test", private: %{validate_body: @schema} do
Plug.Conn.send_resp(conn, 200, "")
end
end
describe "Testing plug with json errors" do
test "QueryString validation with valid query params" do
conn =
:get
|> Plug.Test.conn("/test?id=123")
|> TestRouterJson.call([])
assert conn.state == :sent
assert conn.status == 200
assert conn.query_params == %{"id" => "123"}
assert conn.resp_body == ""
end
test "QueryString Validation error" do
conn =
:get
|> Plug.Test.conn("/test?id=&name=Boo")
|> TestRouterJson.call([])
assert conn.state == :sent
assert conn.status == 400
assert conn.query_params == %{"id" => "", "name" => "Boo"}
assert Jason.decode!(conn.resp_body) == %{"error" => "The field 'id' is required."}
end
test "Body validation with valid body params" do
conn =
:post
|> Plug.Test.conn("/test", %{"id" => "123"})
|> TestRouterJson.call([])
assert conn.state == :sent
assert conn.status == 200
assert conn.body_params == %{"id" => "123"}
end
test "Body validation error" do
conn =
:post
|> Plug.Test.conn("/test", %{"id" => ""})
|> TestRouterJson.call([])
assert conn.state == :sent
assert conn.status == 400
assert conn.body_params == %{"id" => ""}
assert Jason.decode!(conn.resp_body) == %{"error" => "The field 'id' is required."}
end
end
describe "Testing plug with text plain errors" do
test "QueryString validation with valid query params" do
conn =
:get
|> Plug.Test.conn("/test?id=123")
|> TestRouterPlainText.call([])
assert conn.state == :sent
assert conn.status == 200
assert conn.query_params == %{"id" => "123"}
assert conn.resp_body == ""
end
test "QueryString Validation error" do
conn =
:get
|> Plug.Test.conn("/test?id=&name=Boo")
|> TestRouterPlainText.call([])
assert conn.state == :sent
assert conn.status == 400
assert conn.query_params == %{"id" => "", "name" => "Boo"}
assert conn.resp_body == "The field 'id' is required."
end
test "Body validation with valid body params" do
conn =
:post
|> Plug.Test.conn("/test", %{"id" => "123"})
|> TestRouterPlainText.call([])
assert conn.state == :sent
assert conn.status == 200
assert conn.body_params == %{"id" => "123"}
end
test "Body validation error" do
conn =
:post
|> Plug.Test.conn("/test", %{"id" => ""})
|> TestRouterPlainText.call([])
assert conn.state == :sent
assert conn.status == 400
assert conn.body_params == %{"id" => ""}
assert conn.resp_body == "The field 'id' is required."
end
end
describe "Testing plug with custom function error." do
test "QueryString Validation error" do
conn =
:get
|> Plug.Test.conn("/test?id=&name=Boo")
|> TestRouterCustomErrorFn.call([])
assert conn.state == :sent
assert conn.status == 400
assert conn.query_params == %{"id" => "", "name" => "Boo"}
assert conn.resp_body == "The field 'id' is required. CUSTOM"
end
test "Body validation error" do
conn =
:post
|> Plug.Test.conn("/test", %{"id" => ""})
|> TestRouterCustomErrorFn.call([])
assert conn.state == :sent
assert conn.status == 400
assert conn.body_params == %{"id" => ""}
assert conn.resp_body == "The field 'id' is required. CUSTOM"
end
end
# AUXILIAR FUNCTIONS
def custom_error(conn, error_message) do
conn
|> Plug.Conn.put_resp_header("content-type", "text/plain")
|> Plug.Conn.send_resp(400, error_message <> " CUSTOM")
|> Plug.Conn.halt()
end
end
| 26.387255 | 89 | 0.582946 |
9e8b9613da6ada7a0fe3bd537ef2bcecfa87bf77 | 80 | exs | Elixir | apps/welcome/test/welcome_web/views/page_view_test.exs | norbu09/e_no_time | 16a0db136dd91cdcf38d4aab5f11b0684dae289d | [
"BSD-2-Clause"
] | null | null | null | apps/welcome/test/welcome_web/views/page_view_test.exs | norbu09/e_no_time | 16a0db136dd91cdcf38d4aab5f11b0684dae289d | [
"BSD-2-Clause"
] | null | null | null | apps/welcome/test/welcome_web/views/page_view_test.exs | norbu09/e_no_time | 16a0db136dd91cdcf38d4aab5f11b0684dae289d | [
"BSD-2-Clause"
] | null | null | null | defmodule WelcomeWeb.PageViewTest do
use WelcomeWeb.ConnCase, async: true
end
| 20 | 38 | 0.825 |
9e8b96663e7bf3ec49cdc9523fdffb8d2bd7acf6 | 5,797 | ex | Elixir | lib/microdata.ex | chefconnie/microdata | e43c890bab184e196fd943207c6232dbcf1123d2 | [
"MIT"
] | 3 | 2018-11-12T07:06:57.000Z | 2020-11-01T19:00:02.000Z | lib/microdata.ex | chefconnie/microdata | e43c890bab184e196fd943207c6232dbcf1123d2 | [
"MIT"
] | 1 | 2019-01-31T19:00:53.000Z | 2019-01-31T19:00:53.000Z | lib/microdata.ex | anulman/microdata | e43c890bab184e196fd943207c6232dbcf1123d2 | [
"MIT"
] | 4 | 2019-08-14T19:40:16.000Z | 2020-11-01T19:41:06.000Z | defmodule Microdata do
@moduledoc """
`Microdata` is an Elixir library for parsing [microdata](https://www.w3.org/TR/microdata) from a provided document.
### Dependencies
#### Meeseeks + Rust
Microdata parses HTML with [Meeseeks](https://github.com/mischov/meeseeks), which depends on [html5ever](https://github.com/servo/html5ever) via [meeseeks_html5ever](https://github.com/mischov/meeseeks_html5ever).
Because html5ever is a Rust library, you will need to have the Rust compiler [installed](https://www.rust-lang.org/en-US/install.html).
This dependency is necessary because there are no HTML5 spec compliant parsers written in Elixir/Erlang.
#### HTTPoison
If you are using the provided `Microdata.parse(url: ...)` helper function, your library / application will need to declare a dep on HTTPoison (see below).
### Installation
- Ensure your build machine has the Rust compiler installed (see above)
- Add `microdata` to your `mix.exs` deps
- If you plan to use the `Microdata.parse(url: ...)` helper function, include a line for `{:httpoison, "~> 1.0"}`
```elixir
def deps do
[
{:microdata, "~> 0.1.0"},
{:httpoison, "~> 1.0"} # optional
]
end
```
- Run `mix deps.get`
### Usage
Available [on HexDocs](https://hexdocs.pm/microdata). TL;DR:
- `Microdata.parse(html_text)`, if you've already fetched / read your HTML
- `Microdata.parse(file: "path_to_file.html")`, if you're reading from file
- `Microdata.parse(url: "https://website.com/path/to/page")`, if you'd like to fetch & parse
- Uses `HTTPoison ~> 1.0` under the hood; this is an optional dep so you'll want to add it to your `mix.exs` deps as well (see above)
It should be noted that even though the library will find and read JSON-LD in an HTML page's `<script>` tags, it will
not process JSON-LD returned as the body of an HTTP response. Passing a JSON-LD string as text will likewise not
parse. Patches to add such functionality are welcome!
### Configuration
In your `config.exs` you can can set the value of `{:microdata, :strategies}` to a list of modules to consult (in order)
when looking for microdata content. Modules must conform to `Microdata.Strategy`. By default, the Microdata library uses, in order:
* `Microdata.Strategy.HTMLMicroformat` - Looks for microdata in HTML tags
* `Microdata.Strategy.JSONLD` - Looks for microdata in JSON-LD script tags
### Roadmap
- Community contribs would be appreciated to add `itemref` support :)
### Helpful Links
- [Microdata spec](https://www.w3.org/TR/microdata)
### Credits
Thanks muchly to the team + community behind [meeseeks](https://hex.pm/packages/meeseeks), particularly [@mischov](https://github.com/mischov/), for the support and fixes on esoteric XPath issues.
### An Invitation

Next time you're cooking, **don't risk** getting **raw chicken juice** or **sticky sauces** on your **fancy cookbooks** and **expensive electronics**! We are working on **Connie**, a **conversational cooking assistant** that uses Alexa & Google Home to answer questions like:
> What am I supposed to be doing?
>
> What's next for the lasagna?
We wrote this lib to parse imported recipes and wanted to share it back with the community, as there are loads of ways you might use microdata in your own projects. Hope you enjoy!
If you'd like to join our **private beta**, please send an email to [hi [AT] cookformom [DOT] com](mailto:[email protected]), letting us know:
- Which voice assistant you use;
- Your favourite meal; and
- What you want to learn to cook next.
Have a nice day :)
"""
alias Microdata.{Document, Error}
@doc """
Parses Microdata from a given document, and returns a %Microdata.Document{} struct.
## Examples (n.b. tested manually; not a doctest!)
```
iex> Microdata.parse("<html itemscope itemtype='foo'><body><p itemprop='bar'>baz</p></body></html>")
{:ok,
%Microdata.Document{
items: [
%Microdata.Item{
types: ["foo"],
properties: [
%Microdata.Property{
id: nil,
properties: [
%Microdata.Property{
names: ["bar"],
value: "baz"
}
],
}
],
types: ["foo"]
}
]
}
}
iex> Microdata.parse(file: "path/to/file.html")
{:ok, %Microdata.Document{...}}
iex> Microdata.parse(url: "https://website.com/path/to/page")
{:ok, %Microdata.Document{...}}
```
"""
@default_strategies [Microdata.Strategy.HTMLMicrodata, Microdata.Strategy.JSONLD]
@spec parse(file: String.t()) :: {:ok, Document.t()} | {:error, Error.t()}
@spec parse(url: String.t()) :: {:ok, Document.t()} | {:error, Error.t()}
@spec parse(String.t()) :: {:ok, Document.t()} | {:error, Error.t()}
@spec parse(String.t(), base_uri: String.t()) :: {:ok, Document.t()} | {:error, Error.t()}
# credo:disable-for-next-line Credo.Check.Refactor.PipeChainStart
def parse(file: path), do: File.read!(path) |> parse(base_uri: path)
# credo:disable-for-next-line Credo.Check.Refactor.PipeChainStart
def parse(url: url), do: HTTPoison.get!(url).body |> parse(base_uri: url)
def parse(html), do: parse(html, base_uri: nil)
def parse(html, base_uri: base_uri) do
doc = html |> Meeseeks.parse()
strategies()
|> Enum.flat_map(& &1.parse_items(doc, base_uri))
|> case do
items when items != [] ->
{:ok, %Document{items: items}}
_ ->
{:error, Error.new(:document, :no_items, %{input: html})}
end
end
defp strategies do
Application.get_env(:microdata, :strategies, @default_strategies)
end
end
| 39.168919 | 277 | 0.662412 |
9e8bbdc3dc2e1c32d6bf6020405663733921a59d | 1,038 | exs | Elixir | test/faktory_worker/job_supervisor_test.exs | MValle21/faktory_worker | 47a2224778f7ff45800bff3cb2dd3de283f9cbd9 | [
"MIT"
] | 17 | 2019-04-14T21:35:33.000Z | 2019-10-26T10:36:35.000Z | test/faktory_worker/job_supervisor_test.exs | MValle21/faktory_worker | 47a2224778f7ff45800bff3cb2dd3de283f9cbd9 | [
"MIT"
] | 75 | 2019-03-12T12:09:34.000Z | 2020-01-04T14:19:11.000Z | test/faktory_worker/job_supervisor_test.exs | MValle21/faktory_worker | 47a2224778f7ff45800bff3cb2dd3de283f9cbd9 | [
"MIT"
] | 4 | 2020-10-26T17:21:59.000Z | 2021-04-17T18:05:10.000Z | defmodule FaktoryWorker.JobSupervisorTest do
use ExUnit.Case
alias FaktoryWorker.JobSupervisor
describe "child_spec/1" do
test "should return a default child_spec" do
opts = [name: FaktoryWorker]
child_spec = JobSupervisor.child_spec(opts)
assert child_spec == %{
id: FaktoryWorker_job_supervisor,
start: {Task.Supervisor, :start_link, [[name: FaktoryWorker_job_supervisor]]}
}
end
test "should allow a custom name to be specified" do
opts = [name: :test_faktory]
child_spec = JobSupervisor.child_spec(opts)
assert child_spec == %{
id: :test_faktory_job_supervisor,
start: {Task.Supervisor, :start_link, [[name: :test_faktory_job_supervisor]]}
}
end
end
describe "format_supervisor_name/1" do
test "should return the full job supervisor name" do
name = JobSupervisor.format_supervisor_name(:test_faktory)
assert name == :test_faktory_job_supervisor
end
end
end
| 28.833333 | 92 | 0.665703 |
9e8bd620fafa3184376488ee8b2d47d2bff5407a | 4,242 | exs | Elixir | test/oli/delivery/paywall/providers/stripe_test.exs | DevShashi1993/oli-torus | e6e0b66f0973f9790a5785731b22db6fb1c50a73 | [
"MIT"
] | null | null | null | test/oli/delivery/paywall/providers/stripe_test.exs | DevShashi1993/oli-torus | e6e0b66f0973f9790a5785731b22db6fb1c50a73 | [
"MIT"
] | null | null | null | test/oli/delivery/paywall/providers/stripe_test.exs | DevShashi1993/oli-torus | e6e0b66f0973f9790a5785731b22db6fb1c50a73 | [
"MIT"
] | null | null | null | defmodule Oli.Delivery.Paywall.Providers.StripeTest do
use Oli.DataCase
alias Oli.Delivery.Sections
alias Oli.Delivery.Paywall
alias Oli.Delivery.Paywall.Providers.Stripe
alias Lti_1p3.Tool.ContextRoles
alias Oli.Publishing
import Ecto.Query, warn: false
alias Oli.Test.MockHTTP
import Mox
describe "intent-driven pending payment and finalization of payment" do
setup do
map = Seeder.base_project_with_resource2()
{:ok, _} = Publishing.publish_project(map.project, "some changes")
# Create a product using the initial publication
{:ok, product} =
Sections.create_section(%{
type: :blueprint,
requires_payment: true,
amount: Money.new(:USD, 100),
title: "1",
timezone: "1",
registration_open: true,
context_id: "1",
institution_id: map.institution.id,
base_project_id: map.project.id
})
user1 = user_fixture() |> Repo.preload(:platform_roles)
{:ok, section} =
Sections.create_section(%{
type: :enrollable,
requires_payment: true,
amount: Money.new(:USD, 100),
title: "1",
timezone: "1",
registration_open: true,
has_grace_period: false,
context_id: "1",
start_date: DateTime.add(DateTime.utc_now(), -5),
end_date: DateTime.add(DateTime.utc_now(), 5),
institution_id: map.institution.id,
base_project_id: map.project.id,
blueprint_id: product.id
})
Sections.enroll(user1.id, section.id, [ContextRoles.get_role(:context_learner)])
%{
product: product,
section: section,
map: map,
user1: user1
}
end
test "finalization fails when no pending payment found", %{} do
assert {:error, "Payment does not exist"} ==
Stripe.finalize_payment(%{"id" => "a_made_up_intent_id"})
end
test "finalization succeeds", %{
section: section,
product: product,
user1: user
} do
url = "https://api.stripe.com/v1/payment_intents"
MockHTTP
|> expect(:post, fn ^url, _body, _headers ->
{:ok,
%HTTPoison.Response{
status_code: 200,
body: "{ \"client_secret\": \"secret\", \"id\": \"test_id\" }"
}}
end)
{:ok, intent} = Stripe.create_intent(Money.new(:USD, 100), user, section, product)
pending_payment = Paywall.get_provider_payment(:stripe, "test_id")
refute is_nil(pending_payment)
assert is_nil(pending_payment.application_date)
assert pending_payment.pending_section_id == section.id
assert pending_payment.pending_user_id == user.id
assert pending_payment.section_id == product.id
assert pending_payment.provider_type == :stripe
assert pending_payment.provider_id == "test_id"
assert {:ok, _} = Stripe.finalize_payment(intent)
finalized = Paywall.get_provider_payment(:stripe, "test_id")
refute is_nil(finalized)
assert finalized.id == pending_payment.id
refute is_nil(finalized.application_date)
assert finalized.pending_section_id == section.id
assert finalized.pending_user_id == user.id
assert finalized.section_id == product.id
assert finalized.provider_type == :stripe
assert finalized.provider_id == "test_id"
e = Oli.Repo.get!(Oli.Delivery.Sections.Enrollment, finalized.enrollment_id)
assert e.user_id == user.id
assert e.section_id == section.id
end
test "double finalization fails", %{
section: section,
product: product,
user1: user
} do
url = "https://api.stripe.com/v1/payment_intents"
MockHTTP
|> expect(:post, fn ^url, _body, _headers ->
{:ok,
%HTTPoison.Response{
status_code: 200,
body: "{ \"client_secret\": \"secret\", \"id\": \"test_id\" }"
}}
end)
{:ok, intent} = Stripe.create_intent(Money.new(:USD, 100), user, section, product)
assert {:ok, _} = Stripe.finalize_payment(intent)
assert {:error, "Payment already finalized"} = Stripe.finalize_payment(intent)
end
end
end
| 31.191176 | 88 | 0.623762 |
9e8bdf08f0dbb4d945987d7681af813caa4d4719 | 251 | ex | Elixir | ecc/lib/evaluator.ex | SaladinoBelisario/c201-hadoken | 96a9fd4e10831f45d29cbb4e96043cb76d455085 | [
"BSD-2-Clause"
] | 1 | 2021-04-23T05:03:49.000Z | 2021-04-23T05:03:49.000Z | ecc/lib/evaluator.ex | SaladinoBelisario/c201-hadoken | 96a9fd4e10831f45d29cbb4e96043cb76d455085 | [
"BSD-2-Clause"
] | null | null | null | ecc/lib/evaluator.ex | SaladinoBelisario/c201-hadoken | 96a9fd4e10831f45d29cbb4e96043cb76d455085 | [
"BSD-2-Clause"
] | null | null | null | defmodule Evaluator do
def evaluator_lexer(tokens) when tokens != [] do
head= hd tokens
tail= tl tokens
if is_list(head) do
head
else
evaluator_lexer(tail)
end
end
def evaluator_lexer(tokens) do
[]
end
end | 16.733333 | 50 | 0.63745 |
9e8be765ad4d054e6dc22038349db34ac329f0ac | 5,509 | ex | Elixir | clients/cloud_tasks/lib/google_api/cloud_tasks/v2beta2/model/queue.ex | mocknen/elixir-google-api | dac4877b5da2694eca6a0b07b3bd0e179e5f3b70 | [
"Apache-2.0"
] | null | null | null | clients/cloud_tasks/lib/google_api/cloud_tasks/v2beta2/model/queue.ex | mocknen/elixir-google-api | dac4877b5da2694eca6a0b07b3bd0e179e5f3b70 | [
"Apache-2.0"
] | null | null | null | clients/cloud_tasks/lib/google_api/cloud_tasks/v2beta2/model/queue.ex | mocknen/elixir-google-api | dac4877b5da2694eca6a0b07b3bd0e179e5f3b70 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This class is auto generated by the swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.
defmodule GoogleApi.CloudTasks.V2beta2.Model.Queue do
@moduledoc """
A queue is a container of related tasks. Queues are configured to manage how those tasks are dispatched. Configurable properties include rate limits, retry options, target types, and others.
## Attributes
- appEngineHttpTarget (AppEngineHttpTarget): App Engine HTTP target. An App Engine queue is a queue that has an AppEngineHttpTarget. Defaults to: `null`.
- name (String.t): Caller-specified and required in CreateQueue, after which it becomes output only. The queue name. The queue name must have the following format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * `LOCATION_ID` is the canonical ID for the queue's location. The list of available locations can be obtained by calling ListLocations. For more information, see https://cloud.google.com/about/locations/. * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters. Defaults to: `null`.
- pullTarget (PullTarget): Pull target. A pull queue is a queue that has a PullTarget. Defaults to: `null`.
- purgeTime (DateTime.t): Output only. The last time this queue was purged. All tasks that were created before this time were purged. A queue can be purged using PurgeQueue, the [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). Purge time will be truncated to the nearest microsecond. Purge time will be unset if the queue has never been purged. Defaults to: `null`.
- rateLimits (RateLimits): Rate limits for task dispatches. rate_limits and retry_config are related because they both control task attempts however they control how tasks are attempted in different ways: * rate_limits controls the total rate of dispatches from a queue (i.e. all traffic dispatched from the queue, regardless of whether the dispatch is from a first attempt or a retry). * retry_config controls what happens to particular a task after its first attempt fails. That is, retry_config controls task retries (the second attempt, third attempt, etc). Defaults to: `null`.
- retryConfig (RetryConfig): Settings that determine the retry behavior. * For tasks created using Cloud Tasks: the queue-level retry settings apply to all tasks in the queue that were created using Cloud Tasks. Retry settings cannot be set on individual tasks. * For tasks created using the App Engine SDK: the queue-level retry settings apply to all tasks in the queue which do not have retry settings explicitly set on the task and were created by the App Engine SDK. See [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). Defaults to: `null`.
- state (String.t): Output only. The state of the queue. `state` can only be changed by called PauseQueue, ResumeQueue, or uploading [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). UpdateQueue cannot be used to change `state`. Defaults to: `null`.
- Enum - one of [STATE_UNSPECIFIED, RUNNING, PAUSED, DISABLED]
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:appEngineHttpTarget => GoogleApi.CloudTasks.V2beta2.Model.AppEngineHttpTarget.t(),
:name => any(),
:pullTarget => GoogleApi.CloudTasks.V2beta2.Model.PullTarget.t(),
:purgeTime => DateTime.t(),
:rateLimits => GoogleApi.CloudTasks.V2beta2.Model.RateLimits.t(),
:retryConfig => GoogleApi.CloudTasks.V2beta2.Model.RetryConfig.t(),
:state => any()
}
field(:appEngineHttpTarget, as: GoogleApi.CloudTasks.V2beta2.Model.AppEngineHttpTarget)
field(:name)
field(:pullTarget, as: GoogleApi.CloudTasks.V2beta2.Model.PullTarget)
field(:purgeTime, as: DateTime)
field(:rateLimits, as: GoogleApi.CloudTasks.V2beta2.Model.RateLimits)
field(:retryConfig, as: GoogleApi.CloudTasks.V2beta2.Model.RetryConfig)
field(:state)
end
defimpl Poison.Decoder, for: GoogleApi.CloudTasks.V2beta2.Model.Queue do
def decode(value, options) do
GoogleApi.CloudTasks.V2beta2.Model.Queue.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.CloudTasks.V2beta2.Model.Queue do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 82.223881 | 884 | 0.753313 |
9e8bea4a3d44bb6a5e1218f2a8aca21a3e40c862 | 1,319 | ex | Elixir | apps/omg_watcher_rpc/lib/web/validators/helpers.ex | boolafish/elixir-omg | 46b568404972f6e4b4da3195d42d4fb622edb934 | [
"Apache-2.0"
] | null | null | null | apps/omg_watcher_rpc/lib/web/validators/helpers.ex | boolafish/elixir-omg | 46b568404972f6e4b4da3195d42d4fb622edb934 | [
"Apache-2.0"
] | null | null | null | apps/omg_watcher_rpc/lib/web/validators/helpers.ex | boolafish/elixir-omg | 46b568404972f6e4b4da3195d42d4fb622edb934 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019-2020 OmiseGO Pte Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
defmodule OMG.WatcherRPC.Web.Validator.Helpers do
@moduledoc """
helper for validators
"""
import OMG.Utils.HttpRPC.Validator.Base, only: [expect: 3]
@doc """
Validates possible params with query constraints, stops on first error.
"""
@spec validate_constraints(%{binary() => any()}, list()) :: {:ok, Keyword.t()} | {:error, any()}
def validate_constraints(params, constraints) do
Enum.reduce_while(constraints, {:ok, []}, fn {key, validators, atom}, {:ok, list} ->
case expect(params, key, validators) do
{:ok, nil} ->
{:cont, {:ok, list}}
{:ok, value} ->
{:cont, {:ok, [{atom, value} | list]}}
error ->
{:halt, error}
end
end)
end
end
| 32.975 | 98 | 0.662623 |
9e8c0a9ae9c760dbe20ab7136b273af1e006f167 | 1,563 | ex | Elixir | clients/artifact_registry/lib/google_api/artifact_registry/v1beta1/model/empty.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2021-12-20T03:40:53.000Z | 2021-12-20T03:40:53.000Z | clients/artifact_registry/lib/google_api/artifact_registry/v1beta1/model/empty.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2020-08-18T00:11:23.000Z | 2020-08-18T00:44:16.000Z | clients/artifact_registry/lib/google_api/artifact_registry/v1beta1/model/empty.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2020-10-04T10:12:44.000Z | 2020-10-04T10:12:44.000Z | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.ArtifactRegistry.V1beta1.Model.Empty do
@moduledoc """
A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
## Attributes
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{}
end
defimpl Poison.Decoder, for: GoogleApi.ArtifactRegistry.V1beta1.Model.Empty do
def decode(value, options) do
GoogleApi.ArtifactRegistry.V1beta1.Model.Empty.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.ArtifactRegistry.V1beta1.Model.Empty do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 37.214286 | 345 | 0.763276 |
9e8c36f12da073b4d7510aeb5076bc8f671ad59a | 803 | ex | Elixir | fisherman_server/lib/fisherman_server_web/live/linear_shells_table/shell_record_component.ex | henrysdev/Fisherman | 57bc51730cedb84a47807e2d617061f2cfe54ffd | [
"MIT"
] | 1 | 2020-05-14T06:07:21.000Z | 2020-05-14T06:07:21.000Z | fisherman_server/lib/fisherman_server_web/live/linear_shells_table/shell_record_component.ex | henrysdev/Fisherman | 57bc51730cedb84a47807e2d617061f2cfe54ffd | [
"MIT"
] | 19 | 2020-05-04T17:29:44.000Z | 2020-07-05T18:15:10.000Z | fisherman_server/lib/fisherman_server_web/live/linear_shells_table/shell_record_component.ex | henrysdev/Fisherman | 57bc51730cedb84a47807e2d617061f2cfe54ffd | [
"MIT"
] | null | null | null | defmodule FishermanServerWeb.Live.LinearShellsTable.ShellRecordComponent do
@moduledoc """
Component for a rendered shell record object
"""
use Phoenix.LiveComponent
@no_error_color "#a0cf93"
@error_color "#f79292"
def render(assigns) do
~L"""
<div class="shell-record"
style="top: <%= @y_offset %>rem;
height: <%= @height %>rem;
background-color: <%= pick_color(@record) %>;"
id="<%= @record.uuid %>"
>
<strong><%= @record.command %></strong>
</div>
"""
end
@doc """
Determines color of the shell record background on basis
of if the command produced an error or not
"""
def pick_color(%{error: error}) do
if Enum.member?(["", nil], error) do
@no_error_color
else
@error_color
end
end
end
| 22.942857 | 75 | 0.613948 |
9e8c5c34a28bfeff874f8978419ec2fdce9babb9 | 736 | ex | Elixir | lib/stripe/list.ex | Rutaba/stripity_stripe | 12c525301c781f9c8c7e578cc0d933f5d35183d5 | [
"BSD-3-Clause"
] | 555 | 2016-11-29T05:02:27.000Z | 2022-03-30T00:47:59.000Z | lib/stripe/list.ex | Rutaba/stripity_stripe | 12c525301c781f9c8c7e578cc0d933f5d35183d5 | [
"BSD-3-Clause"
] | 532 | 2016-11-28T18:22:25.000Z | 2022-03-30T17:04:32.000Z | lib/stripe/list.ex | Rutaba/stripity_stripe | 12c525301c781f9c8c7e578cc0d933f5d35183d5 | [
"BSD-3-Clause"
] | 296 | 2016-12-05T14:04:09.000Z | 2022-03-28T20:39:37.000Z | defmodule Stripe.List do
@moduledoc """
Work with Stripe list objects.
A list is a general-purpose Stripe object which holds one or more
other Stripe objects in its "data" property.
In its current iteration it simply allows serializing into a properly
typed struct.
In future iterations, it should:
- Support multiple types of objects in its collection
- Support fetching the next set of objects (pagination)
"""
use Stripe.Entity
@type value :: term
@type t(value) :: %__MODULE__{
object: String.t(),
data: [value],
has_more: boolean,
total_count: integer | nil,
url: String.t()
}
defstruct [:object, :data, :has_more, :total_count, :url]
end
| 25.37931 | 71 | 0.661685 |
9e8c7d6e4354ee9f82f9e283f92eef93cb7190f5 | 66,218 | ex | Elixir | clients/cloud_identity/lib/google_api/cloud_identity/v1/api/devices.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2021-12-20T03:40:53.000Z | 2021-12-20T03:40:53.000Z | clients/cloud_identity/lib/google_api/cloud_identity/v1/api/devices.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | 1 | 2020-08-18T00:11:23.000Z | 2020-08-18T00:44:16.000Z | clients/cloud_identity/lib/google_api/cloud_identity/v1/api/devices.ex | pojiro/elixir-google-api | 928496a017d3875a1929c6809d9221d79404b910 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.CloudIdentity.V1.Api.Devices do
@moduledoc """
API calls for all endpoints tagged `Devices`.
"""
alias GoogleApi.CloudIdentity.V1.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Cancels an unfinished device wipe. This operation can be used to cancel device wipe in the gap between the wipe operation returning success and the device being wiped. This operation is possible when the device is in a "pending wipe" state. The device enters the "pending wipe" state when a wipe device command is issued, but has not yet been sent to the device. The cancel wipe will fail if the wipe command has already been issued to the device.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique ID assigned to the Device.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_cancel_wipe(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_cancel_wipe(connection, name, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/{+name}:cancelWipe", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Creates a device. Only company-owned device may be created. **Note**: This method is available only to customers who have one of the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `:body` (*type:* `GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1Device.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_create(Tesla.Env.client(), keyword(), keyword()) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_create(connection, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/devices", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Deletes the specified device.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique ID assigned to the Device.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_delete(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_delete(connection, name, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url("/v1/{+name}", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Retrieves the specified device.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in the format: `devices/{device}`, where device is the unique ID assigned to the Device.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Customer in the format: `customers/{customer}`, where customer is the customer to whom the device belongs. If you're using this API for your own organization, use `customers/my_customer`. If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1Device{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_get(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1Device.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_get(connection, name, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1/{+name}", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1Device{}]
)
end
@doc """
Lists/Searches devices.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer in the format: `customers/{customer}`, where customer is the customer to whom the device belongs. If you're using this API for your own organization, use `customers/my_customer`. If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `:filter` (*type:* `String.t`) - Optional. Additional restrictions when fetching list of devices. For a list of search fields, refer to [Mobile device search fields](https://developers.google.com/admin-sdk/directory/v1/search-operators). Multiple search fields are separated by the space character.
* `:orderBy` (*type:* `String.t`) - Optional. Order specification for devices in the response. Only one of the following field names may be used to specify the order: `create_time`, `last_sync_time`, `model`, `os_version`, `device_type` and `serial_number`. `desc` may be specified optionally at the end to specify results to be sorted in descending order. Default order is ascending.
* `:pageSize` (*type:* `integer()`) - Optional. The maximum number of Devices to return. If unspecified, at most 20 Devices will be returned. The maximum value is 100; values above 100 will be coerced to 100.
* `:pageToken` (*type:* `String.t`) - Optional. A page token, received from a previous `ListDevices` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListDevices` must match the call that provided the page token.
* `:view` (*type:* `String.t`) - Optional. The view to use for the List request.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListDevicesResponse{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_list(Tesla.Env.client(), keyword(), keyword()) ::
{:ok,
GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListDevicesResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_list(connection, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query,
:filter => :query,
:orderBy => :query,
:pageSize => :query,
:pageToken => :query,
:view => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1/devices", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++
[
struct:
%GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListDevicesResponse{}
]
)
end
@doc """
Wipes all data on the specified device.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1WipeDeviceRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_wipe(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_wipe(connection, name, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/{+name}:wipe", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Approves device to access user data.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_approve(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_approve(
connection,
name,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/{+name}:approve", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Blocks device from accessing user data
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_block(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_block(
connection,
name,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/{+name}:block", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Cancels an unfinished user account wipe. This operation can be used to cancel device wipe in the gap between the wipe operation returning success and the device being wiped.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_cancel_wipe(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_cancel_wipe(
connection,
name,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/{+name}:cancelWipe", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Deletes the specified DeviceUser. This also revokes the user's access to device data.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_delete(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_delete(
connection,
name,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url("/v1/{+name}", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Retrieves the specified DeviceUser
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1DeviceUser{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_get(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1DeviceUser.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_get(connection, name, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1/{+name}", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++
[struct: %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1DeviceUser{}]
)
end
@doc """
Lists/Searches DeviceUsers.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `parent` (*type:* `String.t`) - Required. To list all DeviceUsers, set this to "devices/-". To list all DeviceUsers owned by a device, set this to the resource name of the device. Format: devices/{device}
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `:filter` (*type:* `String.t`) - Optional. Additional restrictions when fetching list of devices. For a list of search fields, refer to [Mobile device search fields](https://developers.google.com/admin-sdk/directory/v1/search-operators). Multiple search fields are separated by the space character.
* `:orderBy` (*type:* `String.t`) - Optional. Order specification for devices in the response.
* `:pageSize` (*type:* `integer()`) - Optional. The maximum number of DeviceUsers to return. If unspecified, at most 5 DeviceUsers will be returned. The maximum value is 20; values above 20 will be coerced to 20.
* `:pageToken` (*type:* `String.t`) - Optional. A page token, received from a previous `ListDeviceUsers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListBooks` must match the call that provided the page token.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_list(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok,
GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_list(
connection,
parent,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query,
:filter => :query,
:orderBy => :query,
:pageSize => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1/{+parent}/deviceUsers", %{
"parent" => URI.encode(parent, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++
[
struct:
%GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse{}
]
)
end
@doc """
Looks up resource names of the DeviceUsers associated with the caller's credentials, as well as the properties provided in the request. This method must be called with end-user credentials with the scope: https://www.googleapis.com/auth/cloud-identity.devices.lookup If multiple properties are provided, only DeviceUsers having all of these properties are considered as matches - i.e. the query behaves like an AND. Different platforms require different amounts of information from the caller to ensure that the DeviceUser is uniquely identified. - iOS: No properties need to be passed, the caller's credentials are sufficient to identify the corresponding DeviceUser. - Android: Specifying the 'android_id' field is required. - Desktop: Specifying the 'raw_resource_id' field is required.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `parent` (*type:* `String.t`) - Must be set to "devices/-/deviceUsers" to search across all DeviceUser belonging to the user.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:androidId` (*type:* `String.t`) - Android Id returned by [Settings.Secure#ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
* `:pageSize` (*type:* `integer()`) - The maximum number of DeviceUsers to return. If unspecified, at most 20 DeviceUsers will be returned. The maximum value is 20; values above 20 will be coerced to 20.
* `:pageToken` (*type:* `String.t`) - A page token, received from a previous `LookupDeviceUsers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `LookupDeviceUsers` must match the call that provided the page token.
* `:rawResourceId` (*type:* `String.t`) - Raw Resource Id used by Google Endpoint Verification. If the user is enrolled into Google Endpoint Verification, this id will be saved as the 'device_resource_id' field in the following platform dependent files. Mac: ~/.secureConnect/context_aware_config.json Windows: C:\\Users\\%USERPROFILE%\\.secureConnect\\context_aware_config.json Linux: ~/.secureConnect/context_aware_config.json
* `:userId` (*type:* `String.t`) - The user whose DeviceUser's resource name will be fetched. Must be set to 'me' to fetch the DeviceUser's resource name for the calling user.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_lookup(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok,
GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_lookup(
connection,
parent,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:androidId => :query,
:pageSize => :query,
:pageToken => :query,
:rawResourceId => :query,
:userId => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1/{+parent}:lookup", %{
"parent" => URI.encode(parent, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++
[
struct:
%GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse{}
]
)
end
@doc """
Wipes the user's account on a device. Other data on the device that is not associated with the user's work account is not affected. For example, if a Gmail app is installed on a device that is used for personal and work purposes, and the user is logged in to the Gmail app with their personal account as well as their work account, wiping the "deviceUser" by their work administrator will not affect their personal account within Gmail or other apps such as Photos.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_wipe(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_wipe(connection, name, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/{+name}:wipe", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
@doc """
Gets the client state for the device user
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientStates/{partner}`, where `device` is the unique ID assigned to the Device, `device_user` is the unique ID assigned to the User and `partner` identifies the partner storing the data. To get the client state for devices belonging to your own organization, the `partnerId` is in the format: `customerId-*anystring*`. Where the `customerId` is your organization's customer ID and `anystring` is any suffix. This suffix is used in setting up Custom Access Levels in Context-Aware Access. You may use `my_customer` instead of the customer ID for devices managed by your own organization. You may specify `-` in place of the `{device}`, so the ClientState resource name can be: `devices/-/deviceUsers/{device_user_resource}/clientStates/{partner}`.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ClientState{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_client_states_get(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ClientState.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_client_states_get(
connection,
name,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1/{+name}", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++
[struct: %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ClientState{}]
)
end
@doc """
Lists the client states for the given search query.
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `parent` (*type:* `String.t`) - Required. To list all ClientStates, set this to "devices/-/deviceUsers/-". To list all ClientStates owned by a DeviceUser, set this to the resource name of the DeviceUser. Format: devices/{device}/deviceUsers/{deviceUser}
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `:filter` (*type:* `String.t`) - Optional. Additional restrictions when fetching list of client states.
* `:orderBy` (*type:* `String.t`) - Optional. Order specification for client states in the response.
* `:pageToken` (*type:* `String.t`) - Optional. A page token, received from a previous `ListClientStates` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListClientStates` must match the call that provided the page token.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListClientStatesResponse{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_client_states_list(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok,
GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListClientStatesResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_client_states_list(
connection,
parent,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query,
:filter => :query,
:orderBy => :query,
:pageToken => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1/{+parent}/clientStates", %{
"parent" => URI.encode(parent, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(
opts ++
[
struct:
%GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ListClientStatesResponse{}
]
)
end
@doc """
Updates the client state for the device user **Note**: This method is available only to customers who have one of the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium
## Parameters
* `connection` (*type:* `GoogleApi.CloudIdentity.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientState/{partner}`, where partner corresponds to the partner storing the data. For partners belonging to the "BeyondCorp Alliance", this is the partner ID specified to you by Google. For all other callers, this is a string of the form: `{customer}-suffix`, where `customer` is your customer ID. The *suffix* is any string the caller specifies. This string will be displayed verbatim in the administration console. This suffix is used in setting up Custom Access Levels in Context-Aware Access. Your organization's customer ID can be obtained from the URL: `GET https://www.googleapis.com/admin/directory/v1/customers/my_customer` The `id` field in the response contains the customer ID starting with the letter 'C'. The customer ID to be used in this API is the string after the letter 'C' (not including 'C')
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:customer` (*type:* `String.t`) - Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
* `:updateMask` (*type:* `String.t`) - Optional. Comma-separated list of fully qualified names of fields to be updated. If not specified, all updatable fields in ClientState are updated.
* `:body` (*type:* `GoogleApi.CloudIdentity.V1.Model.GoogleAppsCloudidentityDevicesV1ClientState.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.CloudIdentity.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec cloudidentity_devices_device_users_client_states_patch(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.CloudIdentity.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def cloudidentity_devices_device_users_client_states_patch(
connection,
name,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:customer => :query,
:updateMask => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url("/v1/{+name}", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.CloudIdentity.V1.Model.Operation{}])
end
end
| 52.9744 | 1,005 | 0.6396 |
9e8c98960e0aa7bf8261f9c39c0068472ac0a01a | 1,097 | ex | Elixir | plugins/ucc_admin/test/support/conn_case.ex | josephkabraham/ucx_ucc | 0dbd9e3eb5940336b4870cff033482ceba5f6ee7 | [
"MIT"
] | null | null | null | plugins/ucc_admin/test/support/conn_case.ex | josephkabraham/ucx_ucc | 0dbd9e3eb5940336b4870cff033482ceba5f6ee7 | [
"MIT"
] | null | null | null | plugins/ucc_admin/test/support/conn_case.ex | josephkabraham/ucx_ucc | 0dbd9e3eb5940336b4870cff033482ceba5f6ee7 | [
"MIT"
] | null | null | null | # defmodule UccAdminWeb.ConnCase do
# @moduledoc """
# This module defines the test case to be used by
# tests that require setting up a connection.
# Such tests rely on `Phoenix.ConnTest` and also
# import other functionality to make it easier
# to build common datastructures and query the data layer.
# Finally, if the test case interacts with the database,
# it cannot be async. For this reason, every test runs
# inside a transaction which is reset at the beginning
# of the test unless the test case is marked as async.
# """
# use ExUnit.CaseTemplate
# using do
# quote do
# # Import conveniences for testing with connections
# use Phoenix.ConnTest
# import UccAdminWeb.Router.Helpers
# # The default endpoint for testing
# @endpoint UcxUccWeb.Endpoint
# end
# end
# setup tags do
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(UcxUcc.Repo)
# unless tags[:async] do
# Ecto.Adapters.SQL.Sandbox.mode(UcxUcc.Repo, {:shared, self()})
# end
# {:ok, conn: Phoenix.ConnTest.build_conn()}
# end
# end
| 28.128205 | 70 | 0.680036 |
9e8cc6cad86be4b25113bb6f8d3b23a2d0f9e296 | 867 | ex | Elixir | lib/erlef_web/live/events_live.ex | starbelly/website | 385c30eabbb2c4f1026147342a0d69fdadd20f4c | [
"Apache-2.0"
] | null | null | null | lib/erlef_web/live/events_live.ex | starbelly/website | 385c30eabbb2c4f1026147342a0d69fdadd20f4c | [
"Apache-2.0"
] | null | null | null | lib/erlef_web/live/events_live.ex | starbelly/website | 385c30eabbb2c4f1026147342a0d69fdadd20f4c | [
"Apache-2.0"
] | null | null | null | defmodule ErlefWeb.EventsLive do
@moduledoc """
Live view for events. Handles the filtering event
"""
use Phoenix.LiveView
alias Erlef.Data.Query.Event, as: Query
def mount(_params, %{"events" => events}, socket) do
socket =
socket
|> assign(:events, events)
|> assign(:filter, "")
{:ok, socket}
end
def render(assigns) do
ErlefWeb.EventView.render("_events.html", assigns)
end
def handle_event("filter", %{"filter" => "ALL"}, socket) do
socket = assign(socket, :filter, "")
{:noreply, assign(socket, :events, Query.approved())}
end
def handle_event("filter", %{"filter" => filter}, socket) do
events = Query.approved() |> Enum.filter(&(&1.event_type.name == filter))
socket =
socket
|> assign(:events, events)
|> assign(:filter, filter)
{:noreply, socket}
end
end
| 22.815789 | 77 | 0.621684 |
9e8ccf441c3ea0b7c668eb61704390c427bdc188 | 5,685 | ex | Elixir | lib/interpreter/cached_interpreter.ex | Rahien/mu-authorization | 4535afd74ae3190d168bbebdf33cb40b919742f5 | [
"MIT"
] | null | null | null | lib/interpreter/cached_interpreter.ex | Rahien/mu-authorization | 4535afd74ae3190d168bbebdf33cb40b919742f5 | [
"MIT"
] | null | null | null | lib/interpreter/cached_interpreter.ex | Rahien/mu-authorization | 4535afd74ae3190d168bbebdf33cb40b919742f5 | [
"MIT"
] | null | null | null | alias InterpreterTerms.SymbolMatch, as: Sym
# We want to check if the first portion of the query consists of a set
# of prefixes which we already know. If that is the case, we can
# shortcut the definition and pull these prefixes off.
#
# However, it may be that there are other prefixes after the ones
# we've seen. Hence we need to cope with that situation as well.
#
# Once we have our prefixes, we should move them to the right spot.
defmodule Interpreter.CachedInterpreter do
require Logger
require ALog
use GenServer
def init(_) do
{:ok, %{}}
end
def handle_call( :list, _from, elements ) do
{ :reply, Map.keys( elements ), elements }
end
def handle_call( { :get, prologue_string }, _from, elements ) do
{ :reply, Map.get( elements, prologue_string ), elements }
end
def handle_cast( { :add, prologue_string, prologue_element }, elements ) do
{ :noreply, Map.put( elements, prologue_string, prologue_element ) }
end
# Tries to find a full solution for the query parsing.
def parse_query_full( query, :Sparql, syntax ) do
query_unit_solution = parse_query_full( query, :QueryUnit, syntax )
sub_solution = %Sym{ string: substring } =
query_unit_solution || parse_query_full( query, :UpdateUnit, syntax )
%Sym{ symbol: :Sparql,
string: substring,
submatches: [sub_solution] }
end
def parse_query_full( query, symbol, syntax ) when symbol in [:QueryUnit,:UpdateUnit] do
{sub_unit,no_prologue_unit} = if symbol == :QueryUnit do
{:Query,:QueryAfterPrologue}
else
{:Update,:UpdateAfterPrologue}
end
prologue_str = find_longest_usable_prologue( query )
if prologue_str do
cut_query = cut_prologue_string( query, prologue_str )
cached_prologue = get_cached_prologue( prologue_str )
after_prologue_solution = parse_query_full_no_cache( cut_query, no_prologue_unit, syntax )
if after_prologue_solution do
%Sym{ submatches: discovered_matches, whitespace: whitespace } = after_prologue_solution
[ %Sym{ whitespace: first_discovered_submatch_whitespace,
string: first_discovered_submatch_string } = first_discovered_submatch
| rest_discovered_submatches ] = discovered_matches
first_discovered_submatch_with_whitespace = %{
first_discovered_submatch |
whitespace: whitespace <> first_discovered_submatch_whitespace,
string: whitespace <> first_discovered_submatch_string }
%Sym{
symbol: symbol,
string: query,
submatches: [
%Sym{
symbol: sub_unit,
string: query,
submatches: [ cached_prologue,
first_discovered_submatch_with_whitespace
| rest_discovered_submatches ]
} ] }
else
parse_query_full_no_cache( query, symbol, syntax )
end
else
parse_query_full_no_cache( query, symbol, syntax )
end
end
def parse_query_full( query, symbol, syntax ) do
rule = {:symbol, symbol}
state = %Generator.State{ chars: String.graphemes( query ), syntax: syntax }
base_solution =
EbnfParser.GeneratorConstructor.dispatch_generation( rule, state )
|> find_full_solution_for_generator
if base_solution do
solution =
base_solution
|> Map.get( :match_construct )
|> List.first
cache_prologue( solution )
solution
end
end
def parse_query_full_no_cache( query, symbol, syntax ) do
rule = {:symbol, symbol}
state = %Generator.State{ chars: String.graphemes( query ), syntax: syntax }
base_solution =
EbnfParser.GeneratorConstructor.dispatch_generation( rule, state )
|> find_full_solution_for_generator
if base_solution do
solution =
base_solution
|> Map.get( :match_construct )
|> List.first
cache_prologue( solution )
solution
end
end
defp find_longest_usable_prologue( query ) do
list_cached_prologues()
|> Enum.sort_by( &byte_size/1, &>=/2 )
|> Enum.find( fn (prologue_string) ->
prologue_size = byte_size(prologue_string)
if prologue_size <= byte_size( query ) do
<<query_prefix::binary-size(prologue_size), _::binary>> = query
query_prefix == prologue_string
end
end )
end
def cut_prologue_string( query, prologue_string ) do
# Note: this code assumes the prefix string is the first part of query
prologue_size = byte_size(prologue_string)
<<_::binary-size(prologue_size), rest_query::binary>> = query
rest_query
end
defp find_full_solution_for_generator( generator ) do
case EbnfParser.Generator.emit( generator ) do
{:ok, new_state , answer } ->
if Generator.Result.full_match? answer do
answer
else
find_full_solution_for_generator( new_state )
end
{:fail} -> nil
end
end
defp cache_prologue( %Sym{ symbol: :Prologue, string: str } = prologue ) do
# Cache this prologue
GenServer.cast( __MODULE__, { :add, str, prologue } )
end
defp cache_prologue( %Sym{ submatches: [submatch|_] } ) do
# Keep walking the left branch to find the Prologue
cache_prologue( submatch )
end
defp cache_prologue(_) do
# This case may appear with the new caches
end
def list_cached_prologues() do
GenServer.call(__MODULE__, :list)
end
def get_cached_prologue( string ) do
GenServer.call(__MODULE__, { :get, string })
end
def start_link(state \\ []) do
GenServer.start_link(__MODULE__, state, name: __MODULE__)
end
end
| 30.72973 | 96 | 0.671944 |
9e8d347d17b37f7e71a2bc46f9c1276d68f269a5 | 7,061 | ex | Elixir | lib/rdf/serializations/turtle_decoder.ex | pukkamustard/rdf-ex | c459d8e7fa548fdfad82643338b68decf380a296 | [
"MIT"
] | null | null | null | lib/rdf/serializations/turtle_decoder.ex | pukkamustard/rdf-ex | c459d8e7fa548fdfad82643338b68decf380a296 | [
"MIT"
] | null | null | null | lib/rdf/serializations/turtle_decoder.ex | pukkamustard/rdf-ex | c459d8e7fa548fdfad82643338b68decf380a296 | [
"MIT"
] | null | null | null | defmodule RDF.Turtle.Decoder do
@moduledoc false
use RDF.Serialization.Decoder
import RDF.Serialization.ParseHelper, only: [error_description: 1]
alias RDF.{Dataset, Graph, IRI}
defmodule State do
defstruct base_iri: nil, namespaces: %{}, bnode_counter: 0
def add_namespace(%State{namespaces: namespaces} = state, ns, iri) do
%State{state | namespaces: Map.put(namespaces, ns, iri)}
end
def ns(%State{namespaces: namespaces}, prefix) do
namespaces[prefix]
end
def next_bnode(%State{bnode_counter: bnode_counter} = state) do
{RDF.bnode("b#{bnode_counter}"),
%State{state | bnode_counter: bnode_counter + 1}}
end
end
@impl RDF.Serialization.Decoder
@spec decode(String.t, keyword | map) :: {:ok, Graph.t | Dataset.t} | {:error, any}
def decode(content, opts \\ %{})
def decode(content, opts) when is_list(opts),
do: decode(content, Map.new(opts))
def decode(content, opts) do
with {:ok, tokens, _} <- tokenize(content),
{:ok, ast} <- parse(tokens),
base_iri = Map.get(opts, :base, Map.get(opts, :base_iri, RDF.default_base_iri())) do
build_graph(ast, base_iri && RDF.iri(base_iri))
else
{:error, {error_line, :turtle_lexer, error_descriptor}, _error_line_again} ->
{:error, "Turtle scanner error on line #{error_line}: #{error_description error_descriptor}"}
{:error, {error_line, :turtle_parser, error_descriptor}} ->
{:error, "Turtle parser error on line #{error_line}: #{error_description error_descriptor}"}
end
end
def tokenize(content), do: content |> to_charlist |> :turtle_lexer.string
def parse([]), do: {:ok, []}
def parse(tokens), do: tokens |> :turtle_parser.parse
defp build_graph(ast, base_iri) do
{graph, %State{namespaces: namespaces, base_iri: base_iri}} =
Enum.reduce ast, {RDF.Graph.new, %State{base_iri: base_iri}}, fn
{:triples, triples_ast}, {graph, state} ->
with {statements, state} = triples(triples_ast, state) do
{RDF.Graph.add(graph, statements), state}
end
{:directive, directive_ast}, {graph, state} ->
{graph, directive(directive_ast, state)}
end
{:ok,
if Enum.empty?(namespaces) do
graph
else
RDF.Graph.add_prefixes(graph, namespaces)
end
|> RDF.Graph.set_base_iri(base_iri)
}
rescue
error -> {:error, Exception.message(error)}
end
defp directive({:prefix, {:prefix_ns, _, ns}, iri}, state) do
if IRI.absolute?(iri) do
State.add_namespace(state, ns, iri)
else
with absolute_iri = IRI.absolute(iri, state.base_iri) do
State.add_namespace(state, ns, to_string(absolute_iri))
end
end
end
defp directive({:base, iri}, %State{base_iri: base_iri} = state) do
cond do
IRI.absolute?(iri) ->
%State{state | base_iri: RDF.iri(iri)}
base_iri != nil ->
with absolute_iri = IRI.absolute(iri, base_iri) do
%State{state | base_iri: absolute_iri}
end
true ->
raise "Could not resolve relative IRI '#{iri}', no base iri provided"
end
end
defp triples({:blankNodePropertyList, _} = ast, state) do
with {_, statements, state} = resolve_node(ast, [], state) do
{statements, state}
end
end
defp triples({subject, predications}, state) do
with {subject, statements, state} = resolve_node(subject, [], state) do
Enum.reduce predications, {statements, state}, fn {predicate, objects}, {statements, state} ->
with {predicate, statements, state} = resolve_node(predicate, statements, state) do
Enum.reduce objects, {statements, state}, fn object, {statements, state} ->
with {object, statements, state} = resolve_node(object, statements, state) do
{[{subject, predicate, object} | statements], state}
end
end
end
end
end
end
defp resolve_node({:prefix_ln, line_number, {prefix, name}}, statements, state) do
if ns = State.ns(state, prefix) do
{RDF.iri(ns <> local_name_unescape(name)), statements, state}
else
raise "line #{line_number}: undefined prefix #{inspect prefix}"
end
end
defp resolve_node({:prefix_ns, line_number, prefix}, statements, state) do
if ns = State.ns(state, prefix) do
{RDF.iri(ns), statements, state}
else
raise "line #{line_number}: undefined prefix #{inspect prefix}"
end
end
defp resolve_node({:relative_iri, relative_iri}, _, %State{base_iri: nil}) do
raise "Could not resolve relative IRI '#{relative_iri}', no base iri provided"
end
defp resolve_node({:relative_iri, relative_iri}, statements, state) do
{IRI.absolute(relative_iri, state.base_iri), statements, state}
end
defp resolve_node({:anon}, statements, state) do
with {node, state} = State.next_bnode(state) do
{node, statements, state}
end
end
defp resolve_node({:blankNodePropertyList, property_list}, statements, state) do
with {subject, state} = State.next_bnode(state),
{new_statements, state} = triples({subject, property_list}, state) do
{subject, statements ++ new_statements, state}
end
end
defp resolve_node({{:string_literal_quote, _line, value}, {:datatype, datatype}}, statements, state) do
with {datatype, statements, state} = resolve_node(datatype, statements, state) do
{RDF.literal(value, datatype: datatype), statements, state}
end
end
defp resolve_node({:collection, []}, statements, state) do
{RDF.nil, statements, state}
end
defp resolve_node({:collection, elements}, statements, state) do
with {first_list_node, state} = State.next_bnode(state),
[first_element | rest_elements] = elements,
{first_element_node, statements, state} =
resolve_node(first_element, statements, state),
first_statement = [{first_list_node, RDF.first, first_element_node}] do
{last_list_node, statements, state} =
Enum.reduce rest_elements, {first_list_node, statements ++ first_statement, state},
fn element, {list_node, statements, state} ->
with {element_node, statements, state} =
resolve_node(element, statements, state),
{next_list_node, state} = State.next_bnode(state) do
{next_list_node, statements ++ [
{list_node, RDF.rest, next_list_node},
{next_list_node, RDF.first, element_node},
], state}
end
end
{first_list_node, statements ++ [{last_list_node, RDF.rest, RDF.nil}], state}
end
end
defp resolve_node(node, statements, state), do: {node, statements, state}
defp local_name_unescape(string),
do: Macro.unescape_string(string, &local_name_unescape_map(&1))
@reserved_characters ~c[~.-!$&'()*+,;=/?#@%_]
defp local_name_unescape_map(e) when e in @reserved_characters, do: e
defp local_name_unescape_map(_), do: false
end
| 35.305 | 105 | 0.649058 |
9e8d3a369576e374124c7ef63403c2626637a1bb | 740 | exs | Elixir | mix.exs | aussiegeek/astro | b1a0e66459250aaa8e1649c840465ed116290164 | [
"BSD-2-Clause"
] | 1 | 2021-01-26T12:05:26.000Z | 2021-01-26T12:05:26.000Z | mix.exs | aussiegeek/astro | b1a0e66459250aaa8e1649c840465ed116290164 | [
"BSD-2-Clause"
] | null | null | null | mix.exs | aussiegeek/astro | b1a0e66459250aaa8e1649c840465ed116290164 | [
"BSD-2-Clause"
] | 1 | 2020-03-08T08:34:11.000Z | 2020-03-08T08:34:11.000Z | defmodule Astro.Mixfile do
use Mix.Project
def project do
[app: :astro,
version: "0.1.0",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
def application do
[
applications: [
:logger,
:timex,
]
]
end
# Dependencies can be Hex packages:
#
# {:mydep, "~> 0.3.0"}
#
# Or git/path repositories:
#
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
#
# Type "mix help deps" for more examples and options
defp deps do
[
{:timex, "~> 3.0"}
]
end
end
| 18.5 | 77 | 0.559459 |
9e8d409f374362c02d1a42ed7af0d85fb03888d6 | 197 | ex | Elixir | test_app/lib/test_app.ex | archan937/mecks_unit | b730ab31ce2cbf01551adbd74b47a765646d435e | [
"Unlicense",
"MIT"
] | 50 | 2019-01-12T08:58:36.000Z | 2022-01-25T22:32:12.000Z | test_app/lib/test_app.ex | archan937/mecks_unit | b730ab31ce2cbf01551adbd74b47a765646d435e | [
"Unlicense",
"MIT"
] | 5 | 2019-02-13T10:19:20.000Z | 2020-04-19T08:49:36.000Z | test_app/lib/test_app.ex | archan937/mecks_unit | b730ab31ce2cbf01551adbd74b47a765646d435e | [
"Unlicense",
"MIT"
] | 6 | 2019-02-24T18:58:50.000Z | 2022-01-25T22:33:32.000Z | defmodule TestApp do
@moduledoc """
Documentation for TestApp.
"""
@doc """
Hello world.
## Examples
iex> TestApp.hello
:world
"""
def hello do
:world
end
end
| 10.368421 | 28 | 0.568528 |
9e8d4d4e69b7ba16951c3e76e6b40f317d744a96 | 2,487 | ex | Elixir | lib/livebook_web/endpoint.ex | brettcannon/livebook | d6c9ab1783efa083aea2ead81e078bb920d57ad6 | [
"Apache-2.0"
] | null | null | null | lib/livebook_web/endpoint.ex | brettcannon/livebook | d6c9ab1783efa083aea2ead81e078bb920d57ad6 | [
"Apache-2.0"
] | null | null | null | lib/livebook_web/endpoint.ex | brettcannon/livebook | d6c9ab1783efa083aea2ead81e078bb920d57ad6 | [
"Apache-2.0"
] | null | null | null | defmodule LivebookWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :livebook
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.
@session_options [
store: :cookie,
key: "_livebook_key",
signing_salt: "deadbook"
]
socket "/live", Phoenix.LiveView.Socket,
# Don't check the origin as we don't know how the web app is gonna be accessed.
# It runs locally, but may be exposed via IP or domain name.
# The WebSocket connection is already protected from CSWSH by using CSRF token.
websocket: [check_origin: false, connect_info: [:user_agent, session: @session_options]]
# We use Escript for distributing Livebook, so we don't
# have access to the files in priv/static at runtime in the prod environment.
# To overcome this we load contents of those files at compilation time,
# so that they become a part of the executable and can be served from memory.
defmodule AssetsMemoryProvider do
use LivebookWeb.MemoryProvider,
from: :livebook,
gzip: true
end
defmodule AssetsFileSystemProvider do
use LivebookWeb.FileSystemProvider,
from: "tmp/static_dev"
end
# Serve static failes at "/"
if code_reloading? do
# In development we use assets from tmp/static_dev (rebuilt dynamically on every change).
# Note that this directory doesn't contain predefined files (e.g. images),
# so we also use `AssetsMemoryProvider` to serve those from priv/static.
plug LivebookWeb.StaticPlug,
at: "/",
file_provider: AssetsFileSystemProvider,
gzip: false
end
plug LivebookWeb.StaticPlug,
at: "/",
file_provider: AssetsMemoryProvider,
gzip: true
# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
if code_reloading? do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
end
plug Phoenix.LiveDashboard.RequestLogger,
param_key: "request_logger",
cookie_key: "request_logger"
plug Plug.RequestId
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library()
plug Plug.MethodOverride
plug Plug.Head
plug Plug.Session, @session_options
plug LivebookWeb.Router
end
| 32.723684 | 93 | 0.726176 |
9e8d579283af001fb8a41395266039e74a88ab1b | 4,132 | ex | Elixir | lib/text_delta/composition.ex | document-delta/text_delta | a37ccbcabf83c845a1040dd4fb4de9f45382aaf0 | [
"MIT"
] | 48 | 2017-05-29T19:39:42.000Z | 2022-03-28T15:53:29.000Z | lib/text_delta/composition.ex | document-delta/text_delta | a37ccbcabf83c845a1040dd4fb4de9f45382aaf0 | [
"MIT"
] | 1 | 2017-05-26T15:03:30.000Z | 2017-05-26T15:37:16.000Z | lib/text_delta/composition.ex | document-delta/text_delta | a37ccbcabf83c845a1040dd4fb4de9f45382aaf0 | [
"MIT"
] | 6 | 2017-11-30T16:54:27.000Z | 2021-05-19T10:27:12.000Z | defmodule TextDelta.Composition do
@moduledoc """
The composition of two non-concurrent deltas into a single delta.
The deltas are composed in such a way that the resulting delta has the same
effect on text state as applying one delta and then the other:
S ○ compose(Oa, Ob) = S ○ Oa ○ Ob
In more simple terms, composition allows you to take many deltas and transform
them into one of equal effect. When used together with Operational
Transformation that allows to reduce system overhead when tracking non-synced
changes.
"""
alias TextDelta.{Operation, Attributes, Iterator}
@doc """
Composes two deltas into a single equivalent delta.
## Example
iex> foo = TextDelta.insert(TextDelta.new(), "Foo")
%TextDelta{ops: [%{insert: "Foo"}]}
iex> bar = TextDelta.insert(TextDelta.new(), "Bar")
%TextDelta{ops: [%{insert: "Bar"}]}
iex> TextDelta.compose(bar, foo)
%TextDelta{ops: [%{insert: "FooBar"}]}
"""
@spec compose(TextDelta.t(), TextDelta.t()) :: TextDelta.t()
def compose(first, second) do
{TextDelta.operations(first), TextDelta.operations(second)}
|> iterate()
|> do_compose(TextDelta.new())
|> TextDelta.trim()
end
defp do_compose({{nil, _}, {nil, _}}, result) do
result
end
defp do_compose({{nil, _}, {op_b, remainder_b}}, result) do
List.foldl([op_b | remainder_b], result, &TextDelta.append(&2, &1))
end
defp do_compose({{op_a, remainder_a}, {nil, _}}, result) do
List.foldl([op_a | remainder_a], result, &TextDelta.append(&2, &1))
end
defp do_compose(
{{%{insert: _} = ins_a, remainder_a},
{%{insert: _} = ins_b, remainder_b}},
result
) do
{[ins_a | remainder_a], remainder_b}
|> iterate()
|> do_compose(TextDelta.append(result, ins_b))
end
defp do_compose(
{{%{insert: el_a} = ins, remainder_a},
{%{retain: _} = ret, remainder_b}},
result
) do
insert = Operation.insert(el_a, compose_attributes(ins, ret))
{remainder_a, remainder_b}
|> iterate()
|> do_compose(TextDelta.append(result, insert))
end
defp do_compose(
{{%{insert: _}, remainder_a}, {%{delete: _}, remainder_b}},
result
) do
{remainder_a, remainder_b}
|> iterate()
|> do_compose(result)
end
defp do_compose(
{{%{delete: _} = del, remainder_a}, {%{insert: _} = ins, remainder_b}},
result
) do
{[del | remainder_a], remainder_b}
|> iterate()
|> do_compose(TextDelta.append(result, ins))
end
defp do_compose(
{{%{delete: _} = del, remainder_a}, {%{retain: _} = ret, remainder_b}},
result
) do
{remainder_a, [ret | remainder_b]}
|> iterate()
|> do_compose(TextDelta.append(result, del))
end
defp do_compose(
{{%{delete: _} = del_a, remainder_a},
{%{delete: _} = del_b, remainder_b}},
result
) do
{remainder_a, [del_b | remainder_b]}
|> iterate()
|> do_compose(TextDelta.append(result, del_a))
end
defp do_compose(
{{%{retain: _} = ret, remainder_a}, {%{insert: _} = ins, remainder_b}},
result
) do
{[ret | remainder_a], remainder_b}
|> iterate()
|> do_compose(TextDelta.append(result, ins))
end
defp do_compose(
{{%{retain: len} = ret_a, remainder_a},
{%{retain: _} = ret_b, remainder_b}},
result
) do
retain = Operation.retain(len, compose_attributes(ret_a, ret_b, true))
{remainder_a, remainder_b}
|> iterate()
|> do_compose(TextDelta.append(result, retain))
end
defp do_compose(
{{%{retain: _}, remainder_a}, {%{delete: _} = del, remainder_b}},
result
) do
{remainder_a, remainder_b}
|> iterate()
|> do_compose(TextDelta.append(result, del))
end
defp iterate(stream), do: Iterator.next(stream, :delete)
defp compose_attributes(op_a, op_b, keep_nil \\ false) do
attrs_a = Map.get(op_a, :attributes)
attrs_b = Map.get(op_b, :attributes)
Attributes.compose(attrs_a, attrs_b, keep_nil)
end
end
| 28.108844 | 80 | 0.61302 |
9e8d5e05d36deae3ef74c436478258feb39a31cb | 580 | ex | Elixir | priv/catalogue/pagination/example01.ex | code-shoily/lotus | d14958956103f2376d51974f40bcc7d7c59c2ad9 | [
"MIT"
] | 3 | 2021-09-20T10:34:15.000Z | 2021-09-20T16:23:07.000Z | priv/catalogue/pagination/example01.ex | code-shoily/lotus | d14958956103f2376d51974f40bcc7d7c59c2ad9 | [
"MIT"
] | null | null | null | priv/catalogue/pagination/example01.ex | code-shoily/lotus | d14958956103f2376d51974f40bcc7d7c59c2ad9 | [
"MIT"
] | 1 | 2021-11-23T13:10:27.000Z | 2021-11-23T13:10:27.000Z | defmodule Lotus.Catalogue.Pagination.Example01 do
use Surface.Catalogue.Example,
subject: Lotus.Pagination,
catalogue: Lotus.Catalogue,
title: "Pagination",
height: "90px",
direction: "vertical",
container: {:div, class: "uk-container"}
alias Lotus.Page
def render(assigns) do
~F"""
<Pagination>
<Page page_active><a href="#">1</a></Page>
<Page><a href="#">2</a></Page>
<Page><a href="#">3</a></Page>
<Page page_disabled><span>4</span></Page>
<Page><a href="#">5</a></Page>
</Pagination>
"""
end
end
| 24.166667 | 49 | 0.594828 |
9e8d8280cc4419ec56c7722a888acb8a8a7fce1d | 575 | exs | Elixir | elixir/city-office/mix.exs | hoangbits/exercism | 11a527d63526e07b1eba114ebeb2fddca8f9419c | [
"MIT"
] | 343 | 2017-06-22T16:28:28.000Z | 2022-03-25T21:33:32.000Z | elixir/city-office/mix.exs | hoangbits/exercism | 11a527d63526e07b1eba114ebeb2fddca8f9419c | [
"MIT"
] | 583 | 2017-06-19T10:48:40.000Z | 2022-03-28T21:43:12.000Z | elixir/city-office/mix.exs | hoangbits/exercism | 11a527d63526e07b1eba114ebeb2fddca8f9419c | [
"MIT"
] | 228 | 2017-07-05T07:09:32.000Z | 2022-03-27T08:59:08.000Z | defmodule Form.MixProject do
use Mix.Project
def project do
[
app: :city_office,
version: "0.1.0",
# elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
end
| 19.827586 | 87 | 0.575652 |
9e8d91bf86fcbb881d342922809b8234526ca563 | 443 | exs | Elixir | .iex.exs | andyl/ragged | 2baab0849e2dfc068652ecb2fe88a7c6fe5437d0 | [
"MIT"
] | null | null | null | .iex.exs | andyl/ragged | 2baab0849e2dfc068652ecb2fe88a7c6fe5437d0 | [
"MIT"
] | 10 | 2021-02-08T00:01:41.000Z | 2021-05-27T12:54:28.000Z | .iex.exs | andyl/ragged | 2baab0849e2dfc068652ecb2fe88a7c6fe5437d0 | [
"MIT"
] | null | null | null | IO.puts("--------------------------- FEEDEX DATA ---------------------------")
import_file_if_available("~/.iex.exs")
alias FeedexData.Ctx.Account
alias FeedexData.Ctx.Account.{User, Folder, Register, ReadLog}
alias FeedexData.Ctx.News
alias FeedexData.Ctx.News.{Feed, Post}
alias FeedexData.Api
alias FeedexData.Api.Subs
alias FeedexUi.Cache.UiState
alias FeedexData.Repo
alias FeedexData.Repo, as: R
import_if_available(Ecto.Query)
| 20.136364 | 78 | 0.693002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.