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
list | 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
list | 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
list | 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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
93afc273b77cfe53e20afbc89234bdc2f956977a
| 1,050
|
exs
|
Elixir
|
mix.exs
|
blendmedia/conform
|
439be07c742bca51a7941eb2794dc6df26866adf
|
[
"MIT"
] | null | null | null |
mix.exs
|
blendmedia/conform
|
439be07c742bca51a7941eb2794dc6df26866adf
|
[
"MIT"
] | null | null | null |
mix.exs
|
blendmedia/conform
|
439be07c742bca51a7941eb2794dc6df26866adf
|
[
"MIT"
] | null | null | null |
defmodule Conform.Mixfile do
use Mix.Project
@compile_peg_task "tasks/compile.peg.exs"
@do_peg_compile? File.exists?(@compile_peg_task)
if @do_peg_compile? do
Code.eval_file @compile_peg_task
end
def project do
[app: :conform,
version: "2.0.0",
elixir: "~> 1.0",
escript: [main_module: Conform],
compilers: compilers(@do_peg_compile?),
description: description(),
package: package(),
deps: deps()]
end
def application do
[applications: [:neotoma]]
end
defp compilers(true), do: [:peg, :erlang, :elixir, :app]
defp compilers(_), do: nil
defp deps do
[{:neotoma, "~> 1.7.3"},
{:ex_doc, "~> 0.10", only: :dev},
{:earmark, "> 0.0.0", only: :dev}]
end
defp description, do: "Easy release configuration for Elixir apps."
defp package do
[ files: ["lib", "src", "priv", "mix.exs", "README.md", "LICENSE"],
maintainers: ["Paul Schoenfelder"],
licenses: ["MIT"],
links: %{ "GitHub": "https://github.com/bitwalker/conform" } ]
end
end
| 25
| 71
| 0.613333
|
93afd0ca2cada0b66dd84ffb8c37dc13b16ac076
| 1,145
|
exs
|
Elixir
|
elixir/codes-from-books/little-elixir/cap11/quickcheck_playground/config/config.exs
|
trxeste/wrk
|
3e05e50ff621866f0361cc8494ce8f6bb4d97fae
|
[
"BSD-3-Clause"
] | 1
|
2017-10-16T03:00:50.000Z
|
2017-10-16T03:00:50.000Z
|
elixir/codes-from-books/little-elixir/cap11/quickcheck_playground/config/config.exs
|
trxeste/wrk
|
3e05e50ff621866f0361cc8494ce8f6bb4d97fae
|
[
"BSD-3-Clause"
] | null | null | null |
elixir/codes-from-books/little-elixir/cap11/quickcheck_playground/config/config.exs
|
trxeste/wrk
|
3e05e50ff621866f0361cc8494ce8f6bb4d97fae
|
[
"BSD-3-Clause"
] | null | null | null |
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
# 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 :quickcheck_playground, key: :value
#
# And access this configuration in your application as:
#
# Application.get_env(:quickcheck_playground, :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"
| 36.935484
| 73
| 0.757205
|
93afdb8aef78909763b9ec61389858368dab1db1
| 4,413
|
ex
|
Elixir
|
lib/ex_pool/manager.ex
|
jcabotc/ex_pool
|
ec5acab0e16aa7b7d5c58abba8aa1ebcf8c5c6e4
|
[
"Apache-2.0"
] | 6
|
2015-11-29T10:43:02.000Z
|
2016-04-07T17:32:17.000Z
|
lib/ex_pool/manager.ex
|
jcabotc/ex_pool
|
ec5acab0e16aa7b7d5c58abba8aa1ebcf8c5c6e4
|
[
"Apache-2.0"
] | null | null | null |
lib/ex_pool/manager.ex
|
jcabotc/ex_pool
|
ec5acab0e16aa7b7d5c58abba8aa1ebcf8c5c6e4
|
[
"Apache-2.0"
] | null | null | null |
defmodule ExPool.Manager do
@moduledoc """
Module to start a pool, and check-in and check-out workers.
When a worker is available, it can be checked-out from the pool.
In case there are no available workers it will respond `{:waiting, state}`
and enqueue the pending request.
When a worker is checked-in with any pending requests, it will
respond with `{:check_out, {requester_identifier, state}}` and
remove from de pending queue the current request.
## Example:
```elixir
defmodule HardWorker do
def start_link(_), do: Agent.start_link(fn -> :ok end)
end
alias ExPool.Manager
state = Manager(worker_mod: HardWorker, size: 1)
# There is a worker available. It can be checked-out.
{:ok, {worker, state}} = Manager.check_out(state, :request_1)
# There are no workers available. The current request identified
# by :request_2 has to wait for available workers.
{:waiting, state} = Manager.check_out(state, :request_2)
# A worker is checked-in but there is a request pending. The
# worker is checked_out to be used by the pending request (:request_2).
{:check_out, {:request_2, state}} = Manager.check_in(state, worker)
# There are no pending requests. The worker is checked-in properly.
{:ok, state} = Manager.check_in(state, worker)
```
"""
alias ExPool.State
alias ExPool.Manager.Populator
alias ExPool.Manager.Info
alias ExPool.Manager.Joiner
alias ExPool.Manager.Requester
alias ExPool.Manager.DownHandler
@doc """
Create a new pool state with the given configuration.
(See State.new/1 for more info about configuration options)
"""
@spec new(config :: [Keyword]) :: State.t
def new(config),
do: State.new(config) |> prepopulate
defp prepopulate(state) do
{workers, state} = Populator.populate(state)
Enum.reduce workers, state, fn (worker, state) ->
{:ok, state} = check_in(state, worker)
state
end
end
@doc """
Gathers information about the current state of the pool.
## Format:
%{
workers: %{
free: <number_of_available_workers>,
in_use: <number_of_workers_in_use>,
total: <total_number_of_workers>
},
waiting: <number_of_processes_waiting_for_an_available_worker>
}
"""
@spec info(State.t) :: map
def info(state), do: Info.get(state)
@doc """
Check-out a worker from the pool.
It receives the state, and a term to identify the current check-out
request. In case there are no workers available, the same term will
be returned by check-in to identify the requester of the worker.
"""
@spec check_out(State.t, from :: any) :: {:ok, {pid, State.t}} | {:waiting, State.t}
def check_out(state, from),
do: Requester.request(state, from)
@doc """
Check-in a worker from the pool.
When returning a worker to the pool, there are 2 possible scenarios:
* There aren't any worker requests pending: The worker is stored in the
pool and responds with `{:ok, state}`.
* There is any worker request pending: The worker is not stored. Instead
the term identifying the request (`from`) is returned expecting the caller to yield
the resource to the requester. It responds with
`{:check_out, {from, worker, state}`.
"""
@spec check_in(State.t, pid) ::
{:ok, State.t} | {:check_out, {from :: any, worker :: pid, State.t}}
def check_in(state, worker) do
case Joiner.join(state, worker) do
{:dead_worker, state} -> handle_dead_worker(state)
{:check_out, {from, worker, state}} -> {:check_out, {from, worker, state}}
{:ok, state} -> {:ok, state}
end
end
@doc """
Handle a process down.
There are 2 types of monitored processes that can crash:
* worker - If the crashed process is a worker, a new one is started
and monitored
* client - If the crashed process is a client, the worker that the
process was using is returned to the pool
"""
@spec process_down(State.t, reference) :: any
def process_down(state, ref) do
case DownHandler.process_down(state, ref) do
{:dead_worker, state} -> handle_dead_worker(state)
{:check_in, {worker, state}} -> check_in(state, worker)
{:ok, state} -> {:ok, state}
end
end
defp handle_dead_worker(state) do
{worker, state} = Populator.add(state)
check_in(state, worker)
end
end
| 30.645833
| 87
| 0.672105
|
93afe0286a6c831cb7494a8674ab2dd6a78d259d
| 710
|
ex
|
Elixir
|
lib/ex_dadata/address/geocode_address.ex
|
Elonsoft/ex_dadata
|
71edca65f9d35fd2c9aa6553e87992b377500a1c
|
[
"MIT"
] | 1
|
2021-08-23T08:24:50.000Z
|
2021-08-23T08:24:50.000Z
|
lib/ex_dadata/address/geocode_address.ex
|
Elonsoft/ex_dadata
|
71edca65f9d35fd2c9aa6553e87992b377500a1c
|
[
"MIT"
] | null | null | null |
lib/ex_dadata/address/geocode_address.ex
|
Elonsoft/ex_dadata
|
71edca65f9d35fd2c9aa6553e87992b377500a1c
|
[
"MIT"
] | null | null | null |
defmodule ExDadata.Address.GeocodeAddress do
@moduledoc false
use Ecto.Schema
alias __MODULE__.{Metro, Row}
alias Ecto.Changeset
@primary_key false
embedded_schema do
embeds_many :items, Row
end
def new!(attrs) when is_list(attrs) do
%{items: items} = do_new!(attrs)
Enum.map(items, fn
%{metro: nil} = data ->
%{data | metro: []}
%{metro: list} = data when is_list(list) ->
metro = Metro.cast_list!(list)
%{data | metro: metro}
end)
end
defp do_new!(items) when is_list(items) do
%__MODULE__{}
|> Changeset.cast(%{"items" => items}, [])
|> Changeset.cast_embed(:items)
|> Changeset.apply_action!(:insert)
end
end
| 20.882353
| 49
| 0.622535
|
93afebecdffe137eaae8f19f8b977aa768b5596a
| 11,220
|
ex
|
Elixir
|
lib/phoenix/endpoint/supervisor.ex
|
50kudos/phoenix
|
2ddd0ee46ddf49e44db0ec876dc9c4cff940f2d2
|
[
"MIT"
] | null | null | null |
lib/phoenix/endpoint/supervisor.ex
|
50kudos/phoenix
|
2ddd0ee46ddf49e44db0ec876dc9c4cff940f2d2
|
[
"MIT"
] | null | null | null |
lib/phoenix/endpoint/supervisor.ex
|
50kudos/phoenix
|
2ddd0ee46ddf49e44db0ec876dc9c4cff940f2d2
|
[
"MIT"
] | null | null | null |
defmodule Phoenix.Endpoint.Supervisor do
# This module contains the logic used by most functions in Phoenix.Endpoint
# as well the supervisor for sockets, adapters, watchers, etc.
@moduledoc false
require Logger
use Supervisor
alias Phoenix.Endpoint.{CowboyAdapter, Cowboy2Adapter}
@doc """
Starts the endpoint supervision tree.
"""
def start_link(otp_app, mod) do
case Supervisor.start_link(__MODULE__, {otp_app, mod}, name: mod) do
{:ok, _} = ok ->
warmup(mod)
ok
{:error, _} = error ->
error
end
end
@doc false
def init({otp_app, mod}) do
id = :crypto.strong_rand_bytes(16) |> Base.encode64
secret_conf =
case mod.init(:supervisor, [endpoint_id: id] ++ config(otp_app, mod)) do
{:ok, conf} -> conf
other -> raise ArgumentError, "expected init/2 callback to return {:ok, config}, got: #{inspect other}"
end
# Drop all secrets from secret_conf before passing it around
conf = Keyword.drop(secret_conf, [:secret_key_base])
server? = server?(conf)
if server? and conf[:code_reloader] do
Phoenix.CodeReloader.Server.check_symlinks()
end
children =
config_children(mod, secret_conf, otp_app) ++
pubsub_children(mod, conf) ++
socket_children(mod) ++
server_children(mod, conf, otp_app, server?) ++
watcher_children(mod, conf, server?)
# Supervisor.init(children, strategy: :one_for_one)
{:ok, {{:one_for_one, 3, 5}, children}}
end
defp pubsub_children(mod, conf) do
pub_conf = conf[:pubsub]
if adapter = pub_conf[:adapter] do
pub_conf = [fastlane: Phoenix.Channel.Server] ++ pub_conf
[supervisor(adapter, [Phoenix.Endpoint.__pubsub_server__!(mod), pub_conf])]
else
[]
end
end
defp socket_children(endpoint) do
endpoint.__sockets__
|> Enum.uniq_by(&elem(&1, 1))
|> Enum.map(fn {_, socket, opts} -> socket.child_spec([endpoint: endpoint] ++ opts) end)
end
defp config_children(mod, conf, otp_app) do
args = [mod, conf, defaults(otp_app, mod), [name: Module.concat(mod, "Config")]]
[worker(Phoenix.Config, args)]
end
defp server_children(mod, config, otp_app, server?) do
if server? do
user_adapter = user_adapter(mod, config)
autodetected_adapter = cowboy_version_adapter()
warn_on_different_adapter_version(user_adapter, autodetected_adapter, mod)
adapter = user_adapter || autodetected_adapter
for {scheme, port} <- [http: 4000, https: 4040], opts = config[scheme] do
port = :proplists.get_value(:port, opts, port)
unless port do
raise "server can't start because :port in #{scheme} config is nil, " <>
"please use a valid port number"
end
opts = [port: port_to_integer(port), otp_app: otp_app] ++ :proplists.delete(:port, opts)
adapter.child_spec(scheme, mod, opts)
end
else
[]
end
end
defp user_adapter(endpoint, config) do
case config[:handler] do
nil ->
config[:adapter]
Phoenix.Endpoint.CowboyHandler ->
Logger.warn "Phoenix.Endpoint.CowboyHandler is deprecated, please use Phoenix.Endpoint.CowboyAdapter instead"
CowboyAdapter
other ->
Logger.warn "The :handler option in #{inspect endpoint} is deprecated, please use :adapter instead"
other
end
end
defp cowboy_version_adapter() do
case Application.spec(:cowboy, :vsn) do
[?1 | _] -> CowboyAdapter
_ -> Cowboy2Adapter
end
end
defp warn_on_different_adapter_version(CowboyAdapter, Cowboy2Adapter, endpoint) do
Logger.warn("""
You have specified #{inspect CowboyAdapter} for Cowboy v1.x \
in the :adapter configuration of your Phoenix endpoint #{inspect endpoint} \
but your mix.exs has fetched Cowboy v2.x.
If you wish to use Cowboy 1, please update mix.exs to point to the \
correct Cowboy version:
{:cowboy, "~> 1.0"}
If you want to use Cowboy 2, then please remove the :adapter option \
in your config.exs file or set it to:
adapter: Phoenix.Endpoint.Cowboy2Adapter
""")
raise "aborting due to adapter mismatch"
end
defp warn_on_different_adapter_version(_user, _autodetected, _endpoint), do: :ok
defp watcher_children(_mod, conf, server?) do
if server? do
Enum.map(conf[:watchers], fn {cmd, args} ->
worker(Phoenix.Endpoint.Watcher, watcher_args(cmd, args),
id: {cmd, args}, restart: :transient)
end)
else
[]
end
end
defp watcher_args(cmd, cmd_args) do
{args, opts} = Enum.split_while(cmd_args, &is_binary(&1))
[cmd, args, opts]
end
@doc """
The endpoint configuration used at compile time.
"""
def config(otp_app, endpoint) do
Phoenix.Config.from_env(otp_app, endpoint, defaults(otp_app, endpoint))
end
@doc """
Checks if Endpoint's web server has been configured to start.
"""
def server?(otp_app, endpoint) when is_atom(otp_app) and is_atom(endpoint) do
otp_app
|> config(endpoint)
|> server?()
end
def server?(conf) when is_list(conf) do
Keyword.get(conf, :server, Application.get_env(:phoenix, :serve_endpoints, false))
end
defp defaults(otp_app, module) do
[otp_app: otp_app,
# Compile-time config
code_reloader: false,
debug_errors: false,
render_errors: [view: render_errors(module), accepts: ~w(html), layout: false],
# Runtime config
cache_static_manifest: nil,
check_origin: true,
http: false,
https: false,
reloadable_apps: nil,
reloadable_compilers: [:gettext, :phoenix, :elixir],
secret_key_base: nil,
static_url: nil,
url: [host: "localhost", path: "/"],
# Supervisor config
pubsub: [pool_size: 1],
watchers: []]
end
defp render_errors(module) do
module
|> Module.split
|> Enum.at(0)
|> Module.concat("ErrorView")
end
@doc """
Callback that changes the configuration from the app callback.
"""
def config_change(endpoint, changed, removed) do
res = Phoenix.Config.config_change(endpoint, changed, removed)
warmup(endpoint)
res
end
@doc """
Builds the endpoint url from its configuration.
The result is wrapped in a `{:cache, value}` tuple so
the `Phoenix.Config` layer knows how to cache it.
"""
def url(endpoint) do
{:cache, build_url(endpoint, endpoint.config(:url)) |> String.Chars.URI.to_string()}
end
@doc """
Builds the host for caching.
"""
def host(endpoint) do
{:cache, host_to_binary(endpoint.config(:url)[:host] || "localhost")}
end
@doc """
Builds the path for caching.
"""
def path(endpoint) do
{:cache, empty_string_if_root(endpoint.config(:url)[:path] || "/")}
end
@doc """
Builds the script_name for caching.
"""
def script_name(endpoint) do
{:cache, String.split(endpoint.config(:url)[:path] || "/", "/", trim: true)}
end
@doc """
Builds the static url from its configuration.
The result is wrapped in a `{:cache, value}` tuple so
the `Phoenix.Config` layer knows how to cache it.
"""
def static_url(endpoint) do
url = endpoint.config(:static_url) || endpoint.config(:url)
{:cache, build_url(endpoint, url) |> String.Chars.URI.to_string()}
end
@doc """
Builds a struct url for user processing.
The result is wrapped in a `{:cache, value}` tuple so
the `Phoenix.Config` layer knows how to cache it.
"""
def struct_url(endpoint) do
url = endpoint.config(:url)
struct = build_url(endpoint, url)
{:cache,
case url[:path] || "/" do
"/" -> struct
path -> %{struct | path: path}
end}
end
defp build_url(endpoint, url) do
build_url(endpoint.config(:https), endpoint.config(:http), url)
end
defp build_url(https, http, url) do
{scheme, port} =
cond do
https ->
{"https", https[:port]}
http ->
{"http", http[:port]}
true ->
{"http", 80}
end
scheme = url[:scheme] || scheme
host = host_to_binary(url[:host] || "localhost")
port = port_to_integer(url[:port] || port)
%URI{scheme: scheme, port: port, host: host}
end
@doc """
Returns the script path root.
"""
def static_path(endpoint) do
script_path = (endpoint.config(:static_url) || endpoint.config(:url))[:path] || "/"
{:cache, empty_string_if_root(script_path)}
end
defp empty_string_if_root("/"), do: ""
defp empty_string_if_root(other), do: other
@doc """
Returns the static path of a file in the static root directory.
When the file exists, it includes a timestamp. When it doesn't exist,
just the static path is returned.
The result is wrapped in a `{:cache | :nocache, value}` tuple so
the `Phoenix.Config` layer knows how to cache it.
"""
@invalid_local_url_chars ["\\"]
def static_path(_endpoint, "//" <> _ = path) do
raise_invalid_path(path)
end
def static_path(_endpoint, "/" <> _ = path) do
if String.contains?(path, @invalid_local_url_chars) do
raise ArgumentError, "unsafe characters detected for path #{inspect path}"
else
{:nocache, path}
end
end
def static_path(_endpoint, path) when is_binary(path) do
raise_invalid_path(path)
end
defp raise_invalid_path(path) do
raise ArgumentError, "expected a path starting with a single / but got #{inspect path}"
end
# TODO: Deprecate {:system, env_var} once we require Elixir v1.7+
defp host_to_binary({:system, env_var}), do: host_to_binary(System.get_env(env_var))
defp host_to_binary(host), do: host
# TODO: Deprecate {:system, env_var} once we require Elixir v1.7+
defp port_to_integer({:system, env_var}), do: port_to_integer(System.get_env(env_var))
defp port_to_integer(port) when is_binary(port), do: String.to_integer(port)
defp port_to_integer(port) when is_integer(port), do: port
@doc """
Invoked to warm up caches on start and config change.
"""
def warmup(endpoint) do
endpoint.host
endpoint.path("/")
endpoint.script_name
warmup_url(endpoint)
warmup_static(endpoint)
:ok
rescue
_ -> :ok
end
defp warmup_url(endpoint) do
endpoint.url
endpoint.static_url
endpoint.struct_url
end
defp warmup_static(endpoint) do
for {key, value} <- cache_static_manifest(endpoint) do
Phoenix.Config.cache(endpoint, {:__phoenix_static__, "/" <> key}, fn _ ->
{:cache, "/" <> value <> "?vsn=d"}
end)
end
endpoint.static_path("/")
end
defp cache_static_manifest(endpoint) do
if inner = endpoint.config(:cache_static_manifest) do
outer = Application.app_dir(endpoint.config(:otp_app), inner)
if File.exists?(outer) do
manifest =
outer
|> File.read!()
|> Phoenix.json_library().decode!()
manifest["latest"]
else
Logger.error "Could not find static manifest at #{inspect outer}. " <>
"Run \"mix phx.digest\" after building your static files " <>
"or remove the configuration from \"config/prod.exs\"."
end
else
%{}
end
end
end
| 28.333333
| 117
| 0.649376
|
93b00447519bd805ac4c8f364133c399410521a7
| 1,188
|
ex
|
Elixir
|
lib/herd/supervisor.ex
|
Frameio/flock
|
e1b003265b6463d8228bfaaf33c14d5c6c7962cb
|
[
"MIT"
] | 11
|
2018-08-16T23:16:25.000Z
|
2022-02-23T18:08:16.000Z
|
lib/herd/supervisor.ex
|
Frameio/flock
|
e1b003265b6463d8228bfaaf33c14d5c6c7962cb
|
[
"MIT"
] | 7
|
2019-04-03T07:29:10.000Z
|
2022-02-22T12:03:01.000Z
|
lib/herd/supervisor.ex
|
Frameio/flock
|
e1b003265b6463d8228bfaaf33c14d5c6c7962cb
|
[
"MIT"
] | 4
|
2019-10-26T10:20:58.000Z
|
2022-02-22T18:18:36.000Z
|
defmodule Herd.Supervisor do
@moduledoc """
Creates a Supervisor for the herd's internal registry, it's pool of pools,
and the cluster. Use with:
```
defmodule MyHerdSupervisor do
use Herd.Supervisor, otp_app: :my_app,
cluster: MyCluster,
pool: MyPool
end
"""
defmacro __using__(opts) do
app = Keyword.get(opts, :otp_app)
pool = Keyword.get(opts, :pool)
cluster = Keyword.get(opts, :cluster)
quote do
use Supervisor
@otp unquote(app)
@pool unquote(pool)
@cluster unquote(cluster)
def start_link(options) do
Supervisor.start_link(__MODULE__, options, name: __MODULE__)
end
def init(options) do
opts = Keyword.put(supervisor_config(), :strategy, :one_for_one)
children = [
# needs to be started FIRST
worker(Registry, [[name: Module.concat(@pool, Registry), keys: :unique]]),
supervisor(@pool, [options]),
worker(@cluster, [options]),
]
supervise(children, opts)
end
def supervisor_config(), do: Application.get_env(@otp, __MODULE__, [])
end
end
end
| 27
| 84
| 0.601852
|
93b028af3b9442a2f1bd7e3fc6be03a8969b62eb
| 5,129
|
ex
|
Elixir
|
clients/vm_migration/lib/google_api/vm_migration/v1/model/compute_engine_target_defaults.ex
|
yoshi-code-bot/elixir-google-api
|
cdb6032f01fac5ab704803113c39f2207e9e019d
|
[
"Apache-2.0"
] | null | null | null |
clients/vm_migration/lib/google_api/vm_migration/v1/model/compute_engine_target_defaults.ex
|
yoshi-code-bot/elixir-google-api
|
cdb6032f01fac5ab704803113c39f2207e9e019d
|
[
"Apache-2.0"
] | null | null | null |
clients/vm_migration/lib/google_api/vm_migration/v1/model/compute_engine_target_defaults.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.VMMigration.V1.Model.ComputeEngineTargetDefaults do
@moduledoc """
ComputeEngineTargetDefaults is a collection of details for creating a VM in a target Compute Engine project.
## Attributes
* `additionalLicenses` (*type:* `list(String.t)`, *default:* `nil`) - Additional licenses to assign to the VM.
* `appliedLicense` (*type:* `GoogleApi.VMMigration.V1.Model.AppliedLicense.t`, *default:* `nil`) - Output only. The OS license returned from the adaptation module report.
* `bootOption` (*type:* `String.t`, *default:* `nil`) - Output only. The VM Boot Option, as set in the source vm.
* `computeScheduling` (*type:* `GoogleApi.VMMigration.V1.Model.ComputeScheduling.t`, *default:* `nil`) - Compute instance scheduling information (if empty default is used).
* `diskType` (*type:* `String.t`, *default:* `nil`) - The disk type to use in the VM.
* `hostname` (*type:* `String.t`, *default:* `nil`) - The hostname to assign to the VM.
* `labels` (*type:* `map()`, *default:* `nil`) - A map of labels to associate with the VM.
* `licenseType` (*type:* `String.t`, *default:* `nil`) - The license type to use in OS adaptation.
* `machineType` (*type:* `String.t`, *default:* `nil`) - The machine type to create the VM with.
* `machineTypeSeries` (*type:* `String.t`, *default:* `nil`) - The machine type series to create the VM with.
* `metadata` (*type:* `map()`, *default:* `nil`) - The metadata key/value pairs to assign to the VM.
* `networkInterfaces` (*type:* `list(GoogleApi.VMMigration.V1.Model.NetworkInterface.t)`, *default:* `nil`) - List of NICs connected to this VM.
* `networkTags` (*type:* `list(String.t)`, *default:* `nil`) - A map of network tags to associate with the VM.
* `secureBoot` (*type:* `boolean()`, *default:* `nil`) - Defines whether the instance has Secure Boot enabled. This can be set to true only if the vm boot option is EFI.
* `serviceAccount` (*type:* `String.t`, *default:* `nil`) - The service account to associate the VM with.
* `targetProject` (*type:* `String.t`, *default:* `nil`) - The full path of the resource of type TargetProject which represents the Compute Engine project in which to create this VM.
* `vmName` (*type:* `String.t`, *default:* `nil`) - The name of the VM to create.
* `zone` (*type:* `String.t`, *default:* `nil`) - The zone in which to create the VM.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:additionalLicenses => list(String.t()) | nil,
:appliedLicense => GoogleApi.VMMigration.V1.Model.AppliedLicense.t() | nil,
:bootOption => String.t() | nil,
:computeScheduling => GoogleApi.VMMigration.V1.Model.ComputeScheduling.t() | nil,
:diskType => String.t() | nil,
:hostname => String.t() | nil,
:labels => map() | nil,
:licenseType => String.t() | nil,
:machineType => String.t() | nil,
:machineTypeSeries => String.t() | nil,
:metadata => map() | nil,
:networkInterfaces => list(GoogleApi.VMMigration.V1.Model.NetworkInterface.t()) | nil,
:networkTags => list(String.t()) | nil,
:secureBoot => boolean() | nil,
:serviceAccount => String.t() | nil,
:targetProject => String.t() | nil,
:vmName => String.t() | nil,
:zone => String.t() | nil
}
field(:additionalLicenses, type: :list)
field(:appliedLicense, as: GoogleApi.VMMigration.V1.Model.AppliedLicense)
field(:bootOption)
field(:computeScheduling, as: GoogleApi.VMMigration.V1.Model.ComputeScheduling)
field(:diskType)
field(:hostname)
field(:labels, type: :map)
field(:licenseType)
field(:machineType)
field(:machineTypeSeries)
field(:metadata, type: :map)
field(:networkInterfaces, as: GoogleApi.VMMigration.V1.Model.NetworkInterface, type: :list)
field(:networkTags, type: :list)
field(:secureBoot)
field(:serviceAccount)
field(:targetProject)
field(:vmName)
field(:zone)
end
defimpl Poison.Decoder, for: GoogleApi.VMMigration.V1.Model.ComputeEngineTargetDefaults do
def decode(value, options) do
GoogleApi.VMMigration.V1.Model.ComputeEngineTargetDefaults.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.VMMigration.V1.Model.ComputeEngineTargetDefaults do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 52.336735
| 186
| 0.677715
|
93b0313b537075d0f391cc6aec75367bfd6e4718
| 2,523
|
exs
|
Elixir
|
config.exs
|
itwks/docker-pleroma
|
f2c3cde034ac1b6bb52dfdbb5560bc65fedda29c
|
[
"MIT"
] | 1
|
2021-01-29T07:18:55.000Z
|
2021-01-29T07:18:55.000Z
|
config.exs
|
itwks/docker-pleroma
|
f2c3cde034ac1b6bb52dfdbb5560bc65fedda29c
|
[
"MIT"
] | null | null | null |
config.exs
|
itwks/docker-pleroma
|
f2c3cde034ac1b6bb52dfdbb5560bc65fedda29c
|
[
"MIT"
] | 3
|
2021-01-29T07:19:01.000Z
|
2021-07-22T12:40:21.000Z
|
import Config
config :pleroma, Pleroma.Web.Endpoint,
url: [host: System.get_env("DOMAIN", "localhost"), scheme: "https", port: 443],
http: [ip: {0, 0, 0, 0}, port: 4000]
config :pleroma, :instance,
name: System.get_env("INSTANCE_NAME", "Pleroma"),
email: System.get_env("ADMIN_EMAIL"),
notify_email: System.get_env("NOTIFY_EMAIL"),
limit: 5000,
registrations_open: true,
federating: true,
healthcheck: true
config :pleroma, :media_proxy,
enabled: false,
redirect_on_failure: true,
base_url: "https://cache.domain.tld"
config :pleroma, Pleroma.Repo,
adapter: Ecto.Adapters.Postgres,
username: System.get_env("DB_USER", "pleroma"),
password: System.fetch_env!("DB_PASS"),
database: System.get_env("DB_NAME", "pleroma"),
hostname: System.get_env("DB_HOST", "db"),
pool_size: 10
# Configure web push notifications
config :web_push_encryption, :vapid_details, subject: "mailto:#{System.get_env("NOTIFY_EMAIL")}"
config :pleroma, :database, rum_enabled: false
config :pleroma, :instance, static_dir: "/var/lib/pleroma/static"
config :pleroma, Pleroma.Uploaders.Local, uploads: "/var/lib/pleroma/uploads"
# We can't store the secrets in this file, since this is baked into the docker image
if not File.exists?("/var/lib/pleroma/secret.exs") do
secret = :crypto.strong_rand_bytes(64) |> Base.encode64() |> binary_part(0, 64)
signing_salt = :crypto.strong_rand_bytes(8) |> Base.encode64() |> binary_part(0, 8)
{web_push_public_key, web_push_private_key} = :crypto.generate_key(:ecdh, :prime256v1)
secret_file =
EEx.eval_string(
"""
import Config
config :pleroma, Pleroma.Web.Endpoint,
secret_key_base: "<%= secret %>",
signing_salt: "<%= signing_salt %>"
config :web_push_encryption, :vapid_details,
public_key: "<%= web_push_public_key %>",
private_key: "<%= web_push_private_key %>"
""",
secret: secret,
signing_salt: signing_salt,
web_push_public_key: Base.url_encode64(web_push_public_key, padding: false),
web_push_private_key: Base.url_encode64(web_push_private_key, padding: false)
)
File.write("/var/lib/pleroma/secret.exs", secret_file)
end
import_config("/var/lib/pleroma/secret.exs")
# For additional user config
if File.exists?("/var/lib/pleroma/config.exs"),
do: import_config("/var/lib/pleroma/config.exs"),
else:
File.write("/var/lib/pleroma/config.exs", """
import Config
# For additional configuration outside of environmental variables
""")
| 34.094595
| 96
| 0.705906
|
93b0ea3deb3c0d73d91d9f7ba4f0462fabdb2b16
| 2,550
|
exs
|
Elixir
|
test/credo/check/consistency/space_around_operators/collector_test.exs
|
elixir-twister/credo
|
619e0ec6e244c5e0c12eeeb58ed9de97e1571d99
|
[
"MIT"
] | null | null | null |
test/credo/check/consistency/space_around_operators/collector_test.exs
|
elixir-twister/credo
|
619e0ec6e244c5e0c12eeeb58ed9de97e1571d99
|
[
"MIT"
] | null | null | null |
test/credo/check/consistency/space_around_operators/collector_test.exs
|
elixir-twister/credo
|
619e0ec6e244c5e0c12eeeb58ed9de97e1571d99
|
[
"MIT"
] | null | null | null |
defmodule Credo.Check.Consistency.SpaceAroundOperators.CollectorTest do
use Credo.TestHelper
alias Credo.Check.Consistency.SpaceAroundOperators.Collector
@with_space """
defmodule Credo.Sample1 do
defmodule InlineModule do
def foobar do
4 + 3
4 - 3
4 * 3
a = 3
4 && 3
"4" <> "3"
4 == 3
[4] ++ [3]
4 == 3
4 > 3
4 >= 3
4 <= 3
range = -999..-1
for op <- [:{}, :%{}, :^, :|, :<>] do
end
something = removed != []
Enum.map(dep.deps, &(&1.app)) ++ current_breadths
&function_capture/1
&:erlang_module.function_capture/3
&Elixir.function_capture/3
&@module.blah/1
end
end
end
"""
@without_space """
defmodule Credo.Sample2 do
def foobar do
1+2
end
end
"""
@mixed """
defmodule Credo.Sample3 do
def foobar do
1+ 2
3 *4
end
end
"""
@with_spaces_special_cases ~S"""
defmodule Credo.Sample2 do
defmodule InlineModule do
def foobar do
child_sources = Enum.drop(child_sources, -1)
TestRepo.all(from p in Post, where: field(p, ^field) = datetime_add(^inserted_at, ^-3, ^"week"))
{literal(-number, type, vars), params}
{time2, _} = :timer.tc(&flush/0, [])
{{:{}, [], [:==, [], [to_escaped_field(field), value]]}, params}
<<_, unquoted::binary-size(size), _>> = quoted
args = Enum.map_join ix+1..ix+length, ",", &"$#{&1}"
end
defp do_underscore(<<?-, t :: binary>>, _) do
end
def escape({:-, _, [number]}, type, params, vars, _env) when is_number(number) do
end
end
end
"""
test "it should report correct frequencies for operators surrounded by spaces" do
result =
@with_space
|> to_source_file()
|> Collector.collect_matches([])
assert %{with_space: 18} == result
end
test "it should report correct frequencies for operators not surrounded by spaces" do
result =
@without_space
|> to_source_file()
|> Collector.collect_matches([])
assert %{without_space: 1} == result
end
test "it should report correct frequencies for mixed cases" do
result =
@mixed
|> to_source_file()
|> Collector.collect_matches([])
assert %{with_space: 2, without_space: 2} == result
end
@tag :to_be_implemented
test "it should NOT report without_space for special cases" do
result =
@with_spaces_special_cases
|> to_source_file()
|> Collector.collect_matches([])
assert %{} == Map.delete(result, :with_spaces)
end
end
| 23.394495
| 102
| 0.601176
|
93b11b2e24f577d7c9171905193f8e0ad125ce1f
| 54
|
ex
|
Elixir
|
lib/solid/parser.ex
|
christopherlai/solid
|
c7f0553f4ce3c12b68484baff42084bee1aa640b
|
[
"MIT"
] | 117
|
2016-09-04T03:56:08.000Z
|
2022-03-28T18:51:56.000Z
|
lib/solid/parser.ex
|
christopherlai/solid
|
c7f0553f4ce3c12b68484baff42084bee1aa640b
|
[
"MIT"
] | 73
|
2017-03-21T09:22:45.000Z
|
2022-03-01T20:48:22.000Z
|
lib/solid/parser.ex
|
christopherlai/solid
|
c7f0553f4ce3c12b68484baff42084bee1aa640b
|
[
"MIT"
] | 25
|
2017-04-02T02:23:01.000Z
|
2022-02-27T20:42:13.000Z
|
defmodule Solid.Parser do
use Solid.Parser.Base
end
| 13.5
| 25
| 0.796296
|
93b140805de806243ffe5426fa647c1018c7cb7d
| 1,068
|
exs
|
Elixir
|
priv/repo/migrations/20150503185054_add_location_index.exs
|
google/strabo
|
edfd59cd2a361df23ca78089255597ecdc62bb93
|
[
"Apache-2.0"
] | 70
|
2015-12-01T11:29:54.000Z
|
2020-10-29T03:40:01.000Z
|
priv/repo/migrations/20150503185054_add_location_index.exs
|
google/strabo
|
edfd59cd2a361df23ca78089255597ecdc62bb93
|
[
"Apache-2.0"
] | null | null | null |
priv/repo/migrations/20150503185054_add_location_index.exs
|
google/strabo
|
edfd59cd2a361df23ca78089255597ecdc62bb93
|
[
"Apache-2.0"
] | 9
|
2017-07-23T10:45:49.000Z
|
2021-07-12T12:27:59.000Z
|
# Copyright 2015 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.
#
################################################################################
defmodule Strabo.Repo.Migrations.AddLocationIndex do
use Ecto.Migration
def up do
execute "CREATE INDEX locations_gix ON locations USING GIST (geom);"
execute "CREATE INDEX uid_idx ON locations (uid);"
execute "CREATE INDEX ts_idx ON locations (ts);"
end
def down do
execute "DROP INDEX locations_gix;"
execute "DROP INDEX uid_idx;"
execute "DROP INDEX ts_idx;"
end
end
| 33.375
| 80
| 0.684457
|
93b15ae3cd857e8879c45d8272b821b230af9320
| 2,595
|
exs
|
Elixir
|
test/password_validator/zxcvbn_validator_test.exs
|
numerai/password-validator-zxcvbn
|
25278f435473e602e91acd9c536c9592bc38e869
|
[
"Apache-2.0"
] | 1
|
2019-10-12T14:31:48.000Z
|
2019-10-12T14:31:48.000Z
|
test/password_validator/zxcvbn_validator_test.exs
|
numerai/password-validator-zxcvbn
|
25278f435473e602e91acd9c536c9592bc38e869
|
[
"Apache-2.0"
] | null | null | null |
test/password_validator/zxcvbn_validator_test.exs
|
numerai/password-validator-zxcvbn
|
25278f435473e602e91acd9c536c9592bc38e869
|
[
"Apache-2.0"
] | 3
|
2021-01-31T22:16:20.000Z
|
2021-02-03T17:43:47.000Z
|
defmodule PasswordValidator.Validators.ZXCVBNValidatorTest do
use ExUnit.Case, async: true
alias PasswordValidator.Validators.ZXCVBNValidator
doctest ZXCVBNValidator
doctest PasswordValidator.ReadmeDoctest
describe "validation" do
test "integration with PasswordValidator" do
opts = [
additional_validators: [PasswordValidator.Validators.ZXCVBNValidator],
zxcvbn: [min_score: 4]
]
assert PasswordValidator.validate_password("poor password", opts) ==
{:error, ["This is similar to a commonly used password"]}
end
end
describe "validate/2" do
import ZXCVBNValidator, only: [validate: 2]
test "when disabled returns :ok" do
assert validate("pass", zxcvbn: :disabled) == :ok
end
test "invalid configuration" do
assert_raise RuntimeError, "ZXCVBN min_score must be between 1 and 4, got -1", fn ->
validate("a password", zxcvbn: [min_score: -1])
end
end
test "a valid password" do
assert validate("some given password", zxcvbn: [min_score: 2]) == :ok
end
test "a nil password" do
assert_raise FunctionClauseError, fn ->
assert validate(nil, []) == :ok
end
end
@tag :pending
test "emoji password can be valid" do
password = "🏆🔥 and words"
assert validate(password, []) == :ok
end
test "a weak password" do
assert validate("one word", zxcvbn: [min_score: 2]) == :ok
assert validate("one word", zxcvbn: [min_score: 3]) ==
{:error, ["Add another word or two. Uncommon words are better."]}
end
test "a password that matches a user input gets a low score" do
password = "myrealname"
assert {:error, _} = validate(password, zxcvbn: [user_inputs: [password], min_score: 1])
assert validate(password, zxcvbn: [user_inputs: [], min_score: 1]) == :ok
end
test "a password that is similar to a user input is penalized" do
password = "myrealname123"
assert validate(password, zxcvbn: [user_inputs: ["myrealname"], min_score: 1]) == :ok
assert {:error, _} = validate(password, zxcvbn: [user_inputs: ["myrealname"], min_score: 2])
assert validate(password, zxcvbn: [user_inputs: [], min_score: 4]) == :ok
end
end
test "README.md version is up to date" do
app = :password_validator_zxcvbn
app_version = Application.spec(app, :vsn) |> to_string()
readme = File.read!("README.md")
[_, readme_version] = Regex.run(~r/{:#{app}, "(.+)"}/, readme)
assert Version.match?(app_version, readme_version)
end
end
| 33.269231
| 98
| 0.651638
|
93b191fe2c99e1cf5b10963999287b4674a02d56
| 255
|
ex
|
Elixir
|
test/_support/test_json.ex
|
kianmeng/mavis
|
6ba154efdfadcce1aca92ac735dadb209380c25b
|
[
"MIT"
] | 97
|
2020-09-22T01:52:19.000Z
|
2022-03-21T17:50:13.000Z
|
test/_support/test_json.ex
|
kianmeng/mavis
|
6ba154efdfadcce1aca92ac735dadb209380c25b
|
[
"MIT"
] | 106
|
2020-09-22T18:55:28.000Z
|
2021-11-30T01:51:04.000Z
|
test/_support/test_json.ex
|
kianmeng/mavis
|
6ba154efdfadcce1aca92ac735dadb209380c25b
|
[
"MIT"
] | 3
|
2020-10-27T22:36:56.000Z
|
2022-01-25T21:00:24.000Z
|
defmodule TypeTest.TestJson do
@type json :: String.t | number | boolean | nil | [json] | %{optional(String.t) => json}
def valid_json?(data) do
json_type = Type.fetch_type!(__MODULE__, :json, [])
Type.type_match?(json_type, data)
end
end
| 25.5
| 90
| 0.666667
|
93b1aa7a458f6a96f405aa920de0f5de444b5098
| 882
|
exs
|
Elixir
|
mix.exs
|
princemaple/elixir-jwt
|
0ca2c8623452a69340969c5cff0ec502dbb7b8a9
|
[
"MIT"
] | 13
|
2017-05-15T13:37:11.000Z
|
2021-07-29T23:06:23.000Z
|
mix.exs
|
princemaple/elixir-jwt
|
0ca2c8623452a69340969c5cff0ec502dbb7b8a9
|
[
"MIT"
] | 7
|
2019-01-26T12:42:24.000Z
|
2021-03-16T23:01:00.000Z
|
mix.exs
|
princemaple/elixir-jwt
|
0ca2c8623452a69340969c5cff0ec502dbb7b8a9
|
[
"MIT"
] | 3
|
2019-07-26T06:03:48.000Z
|
2020-01-14T20:42:55.000Z
|
defmodule Jwt.Mixfile do
use Mix.Project
@version "1.4.0"
def project do
[
app: :yajwt,
version: @version,
elixir: "~> 1.9",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
description: "Yet another JWT lib",
deps: deps(),
package: package(),
docs: [
source_ref: "v#{@version}",
main: "JWT",
canonical: "http://hexdocs.pm/yajwt",
source_url: "https://github.com/princemaple/elixir-jwt"
]
]
end
def application do
[extra_applications: [:crypto, :logger, :public_key]]
end
defp deps do
[
{:jason, "~> 1.0"},
{:ex_doc, ">= 0.0.0", only: :docs}
]
end
defp package do
[
maintainers: ["Po Chen"],
licenses: ["MIT"],
links: %{github: "https://github.com/princemaple/elixir-jwt"}
]
end
end
| 20.045455
| 67
| 0.538549
|
93b1cd6aec717dc74058c578fb541e4c36713873
| 510
|
exs
|
Elixir
|
config/test.exs
|
tmecklem/bearings
|
98efda7baba7a4170c46da6a4ccb4f954b0ddc5a
|
[
"MIT"
] | 3
|
2018-05-29T12:16:14.000Z
|
2019-09-25T21:12:36.000Z
|
config/test.exs
|
tmecklem/bearings
|
98efda7baba7a4170c46da6a4ccb4f954b0ddc5a
|
[
"MIT"
] | 23
|
2018-05-25T21:09:43.000Z
|
2021-12-16T05:45:25.000Z
|
config/test.exs
|
tmecklem/bearings
|
98efda7baba7a4170c46da6a4ccb4f954b0ddc5a
|
[
"MIT"
] | null | null | null |
import Config
config :bearings, BearingsWeb.Endpoint,
http: [port: 4001],
server: true
config :bearings, :sql_sandbox, true
# Print only warnings and errors during test
config :logger, level: :warn
# Configure your database
config :bearings, Bearings.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "bearings_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
config :wallaby,
screenshot_on_failure: true,
driver: Wallaby.Chrome
| 21.25
| 44
| 0.745098
|
93b1e3c973cab5860ea89a9de4fd1abd67bf3ac4
| 39
|
exs
|
Elixir
|
.iex.exs
|
mattr-/octicons-ex
|
79b3d5bf746dbc5cc431bd2cd6ba4a71ec7b6978
|
[
"MIT"
] | 3
|
2017-09-25T16:27:50.000Z
|
2021-05-29T02:35:26.000Z
|
.iex.exs
|
mattr-/octicons-ex
|
79b3d5bf746dbc5cc431bd2cd6ba4a71ec7b6978
|
[
"MIT"
] | 41
|
2017-06-05T04:50:09.000Z
|
2021-12-23T13:10:31.000Z
|
.iex.exs
|
mattr-/octicons-ex
|
79b3d5bf746dbc5cc431bd2cd6ba4a71ec7b6978
|
[
"MIT"
] | 3
|
2019-04-23T10:35:17.000Z
|
2021-08-28T13:05:35.000Z
|
import_file_if_available("~/.iex.exs")
| 19.5
| 38
| 0.769231
|
93b1f05b26cba2834f472cd3103be37ee1fb9af7
| 20,767
|
ex
|
Elixir
|
lib/wampum.ex
|
reidiiius/wampum
|
ae825f5c04b4ffcc2b397e1247e80daae3089803
|
[
"MIT"
] | null | null | null |
lib/wampum.ex
|
reidiiius/wampum
|
ae825f5c04b4ffcc2b397e1247e80daae3089803
|
[
"MIT"
] | null | null | null |
lib/wampum.ex
|
reidiiius/wampum
|
ae825f5c04b4ffcc2b397e1247e80daae3089803
|
[
"MIT"
] | null | null | null |
defmodule Wampum do
@moduledoc """
Display fingerboard matrices of various pitch collections.
## Examples:
View selection menu table of signatures.
iex> Wampum.codex
View selection menu table of tunings.
iex> Wampum.stock
View selected signature with default tuning.
iex> Wampum.weave :N0
View selected signature with specified tuning.
iex> Wampum.weave :cello, :N0
Write to file with specified tuning.
iex> Wampum.gamut :guitar
Read and view file that was written to.
iex> Wampum.audit
Erase file that was written to.
iex> Wampum.gamut :clean
"""
@moduledoc since: "0.1.0"
@hermit 00
@jovian 06
@pillar 08
@copper 12
@saturn 15
@gemini 18
@helios 21
@silver 27
@aquari 30
@vulcan 33
@decans 36
@lintel "Returns a List of Integer elements."
@doc """
- #{@lintel}
"""
@doc since: "0.1.0"
@spec triton() :: [integer()]
def triton do
digs = [
@vulcan,
@saturn,
@vulcan,
@saturn,
@vulcan
]
digs
end
@doc """
- #{@lintel}
"""
@doc since: "0.1.0"
@spec violin() :: [integer()]
def violin do
digs = [
@copper,
@silver,
@jovian,
@helios,
@hermit
]
digs
end
@doc """
- #{@lintel}
"""
@doc since: "0.1.0"
@spec guitar() :: [integer()]
def guitar do
digs = [
@copper,
@vulcan,
@helios,
@jovian,
@silver,
@copper
]
digs
end
@doc """
- #{@lintel}
"""
@doc since: "0.1.0"
@spec quartz() :: [integer()]
def quartz do
digs = [
@aquari,
@saturn,
@hermit,
@helios,
@jovian,
@silver,
@copper,
@vulcan,
@gemini
]
digs
end
@doc """
- #{@lintel}
"""
@doc since: "0.1.0"
@spec thirds() :: [integer()]
def thirds do
digs = [
@jovian,
@aquari,
@gemini,
@jovian,
@aquari,
@gemini
]
digs
end
@doc """
- Returns a Map with Atom keys and String values.
"""
@doc since: "0.1.0"
@spec quipu() :: %{key: binary()}
def quipu do
model = %{
:Z0 => "__ __ __ __ __ __ __ __ __ __ __ __ ",
:J2 => "vv zq __ __ ry wu __ uw __ sx __ qz ",
:J3 => "vt __ tv xq __ ws __ uu __ sw __ qx ",
:J5 => "wr __ ut __ sv oq qo __ __ tu __ rw ",
:J6 => "vu __ tw __ rx wt __ uv yq __ __ qy ",
:K1 => "__ qx vt __ tv xq __ ws __ uu __ sw ",
:K2 => "yr __ __ qz vv zq __ xs __ wu __ uw ",
:K5 => "xr __ wt __ uv yq __ __ qy vu __ tw ",
:K6 => "vs __ tu __ rw wr __ ut __ __ oq qo ",
:N0 => "vr __ tt __ rv wq __ us __ su __ qw ",
:J17 => "__ __ tu __ rw wr __ ut __ sv oq qo ",
:J23 => "vv zq __ xs __ wu __ uw __ sx __ qz ",
:J25 => "qr vp __ __ pv rq wo __ __ yu __ ow ",
:J26 => "vv zq __ __ ry wu __ uw yr __ __ qz ",
:J2H => "vr zp __ __ rv wq __ us __ su __ qw ",
:J35 => "yr __ ot qz __ zq to __ __ wu __ uw ",
:J36 => "vu __ tw xr __ wt __ uv yq __ __ qy ",
:J56 => "xr __ wt __ uv yq so __ qy __ __ tw ",
:J5H => "xr __ wt __ uv yq so __ __ vu __ tw ",
:K12 => "__ sx __ qz vv zq __ xs __ wu __ uw ",
:K15 => "__ rx wt __ uv yq __ __ qy vu __ tw ",
:K16 => "__ zq to __ ry wu __ uw __ __ ot qz ",
:K25 => "yr __ __ qz vv zq __ __ ry wu __ uw ",
:K26 => "vp __ __ pv rq wo __ uy __ __ ow qr ",
:K2H => "vr __ __ pz rv wq __ us __ su __ qw ",
:K34 => "wr __ ut __ __ oq qo vs __ tu __ rw ",
:K56 => "vu __ tw __ rx wt __ __ yq __ os qy ",
:K6H => "vu __ tw __ rx wt __ uv __ __ os qy ",
:J236 => "vv zq __ xs __ wu __ uw yr __ __ qz ",
:J256 => "qr vp __ __ pv rq wo __ uy __ __ ow ",
:J2K5 => "qr vp __ __ pv rq __ __ uy yu __ ow ",
:J2K6 => "vv zq __ __ ry wu __ uw __ __ ot qz ",
:J2L3 => "vv zq to __ __ wu __ uw __ sx __ qz ",
:J36H => "vo __ ty xu __ ww __ ux yt __ __ qq ",
:J3K5 => "yr __ ot qz __ zq __ __ ry wu __ uw ",
:J3K6 => "vo __ ty xu __ ww __ ux __ __ ov qq ",
:J5L6 => "wr __ ut __ sv oq qo vs __ __ __ rw ",
:J6L7 => "vr __ tt __ rv wq __ us yy su __ __ ",
:K125 => "__ sx __ qz vv zq __ __ ry wu __ uw ",
:K15H => "__ ux yt __ ov qq __ __ ty xu __ ww ",
:K1J5 => "__ ux yt __ ov qq vo __ __ xu __ ww ",
:K1J6 => "__ zq to __ ry wu __ uw yr __ __ qz ",
:K256 => "vp __ __ pv rq wo __ __ yu __ ow qr ",
:K2J5 => "yr __ __ qz vv zq to __ __ wu __ uw ",
:K2J6 => "vp __ __ pv rq wo __ uy yu __ __ qr ",
:K2M1 => "__ __ ot qz vv zq __ xs __ wu __ uw ",
:K5M4 => "vr __ tt __ rv __ __ us yy su __ qw ",
:K6M5 => "vs __ tu __ rw wr __ __ __ sv oq qo ",
:N167 => "yr __ __ qz __ zq to __ ry wu __ uw ",
:N345 => "__ zq __ __ ry wu __ uw yr __ ot qz ",
:N5L2 => "vp __ __ pv rq __ __ uy yu __ ow qr ",
:N6M2 => "qr vp __ __ pv rq wo __ uy yu __ __ ",
:J17L2 => "vs __ __ __ rw wr __ ut __ sv oq qo ",
:J23K6 => "vv zq __ xs __ wu __ uw __ __ ot qz ",
:J25L6 => "or qp __ __ tv pq ro ws __ __ __ sw ",
:J26L3 => "vv zq to __ __ wu __ uw yr __ __ qz ",
:J2K34 => "or qp __ __ __ pq ro ws __ uu __ sw ",
:J2K56 => "vv zq __ __ ry wu __ __ yr __ ot qz ",
:J2K5H => "pr rp __ __ uv yq __ __ qy vu __ tw ",
:J2L3H => "vr zp tt __ __ wq __ us __ su __ qw ",
:J34K6 => "vt __ tv pq ro __ __ uu __ __ or qp ",
:J56L7 => "xr __ wt __ uv yq so __ qy vu __ __ ",
:K12J5 => "__ sx __ qz vv zq to __ __ wu __ uw ",
:K17J5 => "or qp vt __ tv pq ro __ __ uu __ __ ",
:K2J17 => "__ __ __ pq ro ws __ uu __ sw or qp ",
:K2J6H => "vu __ __ pr rp wt __ uv yq __ __ qy ",
:K25M1 => "__ __ ot qz vv zq __ __ ry wu __ uw ",
:K26M5 => "vt __ __ pq ro ws __ __ __ sw or qp ",
:K2J56 => "yr __ __ qz vv zq to __ ry __ __ uw ",
:K2M1H => "__ __ tt pz rv wq __ us __ su __ qw ",
:K34M2 => "wr __ __ __ sv oq qo vs __ tu __ rw ",
:K56M4 => "vu __ tw __ rx __ __ uv yq __ os qy ",
:N25M6 => "or qp vt __ __ pq ro ws __ __ __ sw ",
:N26L5 => "__ __ tv pq ro ws __ __ __ sw or qp ",
:N45L2 => "vo __ __ xu __ ww __ ux yt __ ov qq ",
:N67M2 => "__ ux __ __ ov qq vo __ ty xu __ ww ",
:J136L7 => "__ __ tw xr __ wt __ uv yq so __ qy ",
:J167L2 => "vu __ __ __ rx wt __ uv yq __ os qy ",
:J16L27 => "vr __ __ __ rv wq __ us yy su __ qw ",
:J246L3 => "vv zq to __ ry __ __ uw yr __ __ qz ",
:J26L34 => "vv zq to xs __ __ __ uw yr __ __ qz ",
:J2K5M4 => "yr sp __ __ vv __ __ ps ry wu __ uw ",
:J2K6M5 => "vv zq __ __ ry wu __ __ __ sx ot qz ",
:J2K6L3 => "vv zq to __ __ wu __ uw __ __ ot qz ",
:J346L5 => "yr __ ot qz vv zq __ __ ry __ __ uw ",
:J3K5M4 => "vu __ tw xr __ __ __ uv yq so __ qy ",
:K135M4 => "__ rx wt __ __ yq __ os qy vu __ tw ",
:K157M6 => "vv zq to __ ry wu __ __ yr __ __ qz ",
:K1J6L7 => "__ rx wt __ uv yq __ os qy vu __ __ ",
:K257M1 => "yr __ ot qz vv zq __ __ ry wu __ __ ",
:K25M17 => "__ sx ot qz vv zq __ __ ry wu __ __ ",
:K2J5M1 => "__ __ ot qz vv zq to __ __ wu __ uw ",
:K2J5L6 => "yr __ __ qz vv zq to xs __ __ __ uw ",
:K2J6L7 => "vv __ __ ps ry wu __ uw yr sp __ __ ",
:K345M2 => "xr __ __ __ uv yq so __ qy vu __ tw ",
:K35M24 => "vr __ __ __ rv wq __ us yy su __ qw ",
:N167M4 => "vu __ __ xr __ wt __ uv yq so __ qy ",
:N345L7 => "__ rx __ __ uv yq __ os qy vu __ tw ",
:J167L2H => "vv __ __ __ ry wu __ uw yr __ ot qz ",
:J2K56M4 => "vv zq __ __ ry __ __ uw yr __ ot qz ",
:J3K56M4 => "vo __ ty xu __ __ __ ux yt __ ov qq ",
:K1J56L7 => "__ ux yt __ ov qq vo __ ty xu __ __ ",
:K2J56L7 => "yr __ __ qz vv zq to __ ry wu __ __ ",
:K345M2H => "yr __ __ __ vv zq to __ ry wu __ uw "
}
model
end
@doc """
- Returns a List of Atom elements which is populated with the sorted keys
from the Map returned by `Wampum.quipu/0`.
## Example:
iex> Wampum.quipu() |> Map.keys() |> Enum.sort()
"""
@doc since: "0.1.0"
@spec clefs() :: [atom()]
def clefs do
quipu()
|> Map.keys()
|> Enum.sort()
end
@doc """
- Receives a List and an Integer as arguments.
- Prints an #{@pillar} column tabular grid to screen.
- Returns the Atom `:ok` if successful.
## Example:
iex> Wampum.tablet(Wampum.clefs(), 0)
"""
@doc since: "0.1.0"
@spec tablet([atom()], integer()) :: atom()
def tablet(menu, numb) when numb < length(menu) - 1 do
item = Enum.at(menu, numb)
if rem(numb, @pillar) == @pillar - 1 do
IO.write("\t#{item}\n")
else
IO.write("\t#{item}")
end
tablet(menu, numb + 1)
end
def tablet(menu, numb) do
item = Enum.at(menu, numb)
IO.write("\t#{item}\n")
end
@doc """
- Prints a tabular grid of menu items to the screen. The menu List is
populated by the sorted keys from `Wampum.quipu/0`, and then passed as
the first argument to `Wampum.tablet/2`.
- Returns a Tuple whose first element is the Atom `:ok`, and the second
element is an Integer which represents the length of the List that is
returned by `Wampum.clefs/0`.
"""
@doc since: "0.1.0"
@spec codex() :: {atom(), integer()}
def codex do
menu = clefs()
size = length(menu)
IO.puts("")
tablet(menu, @hermit)
IO.puts("")
{:ok, size}
end
@doc """
- Receives an optional Atom time unit argument.
- Returns an Integer that represents system time.
"""
@doc since: "0.1.0"
@spec horus(atom()) :: integer()
def horus(unit \\ :second) when is_atom(unit) do
System.system_time(unit)
end
@doc """
- Returns a String of #{@decans} characters.
"""
@doc since: "0.1.0"
@spec tacit() :: binary()
def tacit do
String.duplicate("__ ", @copper)
end
@doc """
- Receives a String argument and returns a Boolean.
- Test whether given Bitstring length is greater than or equal to #{@decans}.
- Test whether given String charaters are printable.
## Example:
iex(4)> Wampum.posit? Wampum.quipu[:Z0]
true
iex(5)> Wampum.posit? Wampum.quipu[:Z0] <> "\0"
false
"""
@doc since: "0.1.0"
@spec posit?(binary()) :: boolean()
def posit?(cord) when is_binary(cord) do
span = String.length(cord)
mink = span >= @decans
posh = String.printable?(cord)
mink and posh
end
@doc """
- Receives a String and an Integer as arguments.
- Then test whether String is greater than or equal to #{@decans}, and
if all the characters are printable using `Wampum.posit?` as a filter.
- If test succeeds, returns permuted String at passed Integer index,
else calls `Wampum.tacit` and returns a default String.
## Example:
iex> Wampum.pegbox(Wampum.quipu[:J6], 15)
"wt __ uv yq __ __ qy vu __ tw __ rx "
"""
@doc since: "0.1.0"
@spec pegbox(binary(), integer()) :: binary()
def pegbox(cord, numb) when is_binary(cord) and is_integer(numb) do
span = String.length(cord)
if posit?(cord) do
{zero, part} = {@hermit, span - numb}
redhead = String.slice(cord, numb, part)
pigtail = String.slice(cord, zero, numb)
redhead <> pigtail
else
tacit()
end
end
@doc """
- Receives a List of Integers and a String as arguments.
- Returns a List of Strings permuted at indices of Integer List elements.
## Example:
iex> Wampum.pitch(Wampum.violin, Wampum.quipu[:K5])
"""
@doc since: "0.1.0"
@spec pitch([integer()], binary()) :: [binary()]
def pitch(digs, cord) do
for numb <- digs, do: [] ++ pegbox(cord, numb)
end
@doc """
- Receives a List of String elements as an argument.
- Prints formated String elements to screen.
- Returns the Atom `:ok` if successful.
## Example:
iex(2)> Wampum.board(["tt __ rv wq", "su __ qw vr", "rv wq __ us"])
tt __ rv wq
su __ qw vr
rv wq __ us
:ok
"""
@doc since: "0.1.0"
@spec board([binary()]) :: atom()
def board(harp) when is_list(harp) do
IO.puts("")
Enum.each(harp, fn cord -> IO.puts("\t#{cord}") end)
IO.puts("")
end
# tuning synonyms
@violin [:cello, :cgda, :cgdae, :gdae, :p5t, :viola, :violin]
@triton [:a4t, :bfbf, :bfbfb, :d5t, :fbfb, :triton]
@quartz [:bass, :beadg, :eadg, :eadgc, :p4t, :quartz]
@guitar [:eadgbe, :guitar]
@thirds [:fkbjdn, :m3t, :thirds]
# cleaning synonyms
@scrub [:clean, :clear, :empty, :erase, :scrub]
@doc """
- Returns a sorted List of tuning Atom elements.
"""
@doc since: "0.1.0"
@spec alton() :: [atom()]
def alton do
lats = @violin ++ @triton ++ @quartz ++ @guitar ++ @thirds
Enum.sort(lats)
end
@doc """
- Prints a tabular grid of menu items to the screen. The menu List is
populated by a sorted List of tuning Atoms, and then passed as
the first argument to `Wampum.tablet/2`.
- Returns a Tuple whose first element is the Atom `:ok`, and the second
element is an Integer which represents the length of the menu List.
"""
@doc since: "0.1.0"
@spec stock() :: {atom(), integer()}
def stock do
menu = alton()
size = length(menu)
IO.puts("")
tablet(menu, @hermit)
IO.puts("")
{:ok, size}
end
@doc """
- Receives an optional Atom argument.
- Returns synonymous Atom if argument matches predefined condition,
else returns a Boolean.
## Example:
iex> Wampum.synod(:eadgbe)
:guitar
iex> Wampum.synod(:zigzag)
true
iex> Wampum.synod(nil)
false
"""
@doc since: "0.1.0"
@spec synod(atom()) :: atom()
def synod(tuned \\ nil) when is_atom(tuned) do
cond do
tuned in @violin ->
:violin
tuned in @triton ->
:triton
tuned in @quartz ->
:quartz
tuned in @guitar ->
:guitar
tuned in @thirds ->
:thirds
tuned in @scrub ->
:scrub
tuned in [false, nil] ->
false
true ->
true
end
end
@doc """
- Receives a signature Atom argument.
- Prints matrix of default tuning applied to selected signature.
- Returns a Tuple with two Atoms.
## Example:
iex> Wampum.weave(:N0)
"""
@doc since: "0.1.0"
@spec weave(atom()) :: {atom(), atom()}
def weave(keyed \\ nil) when is_atom(keyed) do
model = quipu()
if Map.has_key?(model, keyed) do
cord = Map.get(model, keyed)
if posit?(cord) do
# default tuning
digs = quartz()
pitch(digs, cord) |> board()
else
wire = inspect(cord, binaries: :as_strings)
IO.puts("\n\t#{wire}\n")
end
{:ok, keyed}
else
wire = inspect(keyed)
IO.puts("\n\t#{wire} ?\n")
{:error, keyed}
end
end
@doc """
- Receives two Atom arguments. The first argument represents the tuning
to implement, while the second argument represents the key signature.
- Prints matrix of specified tuning applied to selected signature.
- Returns a Tuple with two Atoms. If successful, the first element will
be the Atom `:ok`, and the second element will be the tuning implemented.
Else, the first element will be the Atom `:error`, and the second element
will be the causative Atom argument passed.
## Example:
iex> Wampum.weave(:cello, :N0)
"""
@doc since: "0.1.0"
@spec weave(atom(), atom()) :: {atom(), atom()}
def weave(tuned, keyed) when is_atom(tuned) and is_atom(keyed) do
cloak = synod(tuned)
taboo = is_boolean(cloak)
if taboo do
wire = inspect(tuned)
IO.puts("\n\t#{wire} ?\n")
{:error, tuned}
else
model = quipu()
if Map.has_key?(model, keyed) do
cord = Map.get(model, keyed)
if posit?(cord) do
cond do
cloak in [:guitar, :quartz, :thirds, :triton, :violin] ->
digs = apply(__MODULE__, cloak, [])
pitch(digs, cord) |> board()
true ->
wire = inspect(cloak)
IO.puts("\n\t#{wire} ?\n")
end
{:ok, tuned}
else
wire = inspect(cord, binaries: :as_strings)
IO.puts("\n\t#{wire}\n")
end
else
wire = inspect(keyed)
IO.puts("\n\t#{wire} ?\n")
{:error, keyed}
end
end
end
@doc false
@doc since: "0.1.0"
@spec bloom(pid(), binary(), [integer()], binary()) :: atom()
defp bloom(roll, yarn, digs, cord) when is_pid(roll) and is_binary(yarn) do
IO.write(roll, yarn)
if is_list(digs) and is_binary(cord) do
Enum.each(pitch(digs, cord), fn item ->
IO.write(roll, "\t#{item}\n")
end)
end
end
@doc """
- Receives a String Path and returns a Boolean.
- Test whether Path type is relative or absolute.
- If Path type is absolute then return false.
- If relative then test for Path directory.
- If no Path directory then create directory.
- Test if target File exist, if so return true.
- If no File exist, create File and return true.
## Example:
iex> Wampum.venue? "assets/exchequer.txt"
true
"""
@doc since: "0.1.0"
@spec venue?(binary()) :: boolean()
def venue?(route) when is_binary(route) do
typal = Path.type(route)
if typal == :relative do
chest = Path.dirname(route)
unless File.dir?(chest) do
File.mkdir(chest)
end
unless File.exists?(route) do
File.touch(route, horus(:second))
end
true
else
false
end
end
@epilog "assets/exchequer.txt"
@doc """
- Receives an Atom argument which represents either a tuning
implementation or a cleaning procedure.
- Write all signatures implemented with specified tuning to file.
- Overwrite the data that was previously written to file.
- The current file path is: `"#{@epilog}"`
- Returns a Tuple with two Atoms. If successful, the first element will
be the Atom `:ok`, and the second element will be the tuning implemented.
Else, the first element will be the Atom `:error`, and the second element
will be the causative Atom argument passed.
## Examples:
iex> Wampum.gamut(:guitar)
{:ok, :guitar}
iex> Wampum.gamut(:clean)
{:ok, :clean}
iex> Wampum.gamut(:wrong)
{:error, :wrong}
"""
@doc since: "0.1.0"
@spec gamut(atom()) :: {atom(), atom()}
def gamut(tuned \\ nil) when is_atom(tuned) do
cloak = synod(tuned)
taboo = is_boolean(cloak)
if taboo do
wire = inspect(tuned)
IO.puts("\n\t#{wire} ?\n")
{:error, tuned}
else
route = @epilog
typal = Path.type(route)
place = venue?(route)
media = File.regular?(route)
if place and media do
model = quipu()
signs = clefs()
final = List.last(signs)
strum = String.upcase(to_string(tuned))
epoch = horus(:microsecond)
paddy = "\n\n"
File.open(route, [:write, :utf8], fn roll ->
Enum.each(signs, fn keyed ->
cord = Map.get(model, keyed)
yarn = "#{paddy}\t#{keyed}-#{strum}-I#{epoch}\n"
if posit?(cord) do
cond do
cloak in [:guitar, :quartz, :thirds, :triton, :violin] ->
digs = apply(__MODULE__, cloak, [])
bloom(roll, yarn, digs, cord)
:scrub ->
if keyed == final do
IO.write(roll, "")
end
true ->
wire = inspect(cloak)
if keyed == final do
IO.puts("\n\t#{wire} ?\n")
end
end
else
wire = inspect(cord, binaries: :as_strings)
if keyed == final do
IO.puts("\n\t#{wire}\n")
end
end
end)
IO.write(roll, paddy)
end)
{:ok, tuned}
else
IO.puts("\n\tPathology: #{route}\n")
{:error, typal}
end
end
end
@doc """
- Read and view the file that was written to.
- The current file path is: `"#{@epilog}"`
- Returns a Tuple containing an Atom and String path.
"""
@doc since: "0.1.0"
@spec audit() :: {atom(), binary()}
def audit do
route = @epilog
typal = Path.type(route)
place = File.exists?(route)
media = File.regular?(route)
if place and media do
File.read!(route) |> IO.write()
{:ok, route}
else
IO.puts("\n\tPathology: #{route}\n")
{:error, typal}
end
end
end
| 25.20267
| 79
| 0.550055
|
93b1fb5eb64e4289e4686219a978f293b34f1e6a
| 1,127
|
exs
|
Elixir
|
config/config.exs
|
arpnetwork/jsonrpc2_ex
|
b94a26ab207bede74502452bb53d4a25d82e039f
|
[
"Apache-2.0"
] | 3
|
2018-08-13T13:12:19.000Z
|
2018-09-21T16:31:31.000Z
|
config/config.exs
|
arpnetwork/jsonrpc2_ex
|
b94a26ab207bede74502452bb53d4a25d82e039f
|
[
"Apache-2.0"
] | null | null | null |
config/config.exs
|
arpnetwork/jsonrpc2_ex
|
b94a26ab207bede74502452bb53d4a25d82e039f
|
[
"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.
use Mix.Config
# 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 your application as:
#
# config :jsonrpc2, key: :value
#
# and access this configuration in your application as:
#
# Application.get_env(:jsonrpc2, :key)
#
# You can also 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"
| 36.354839
| 73
| 0.750665
|
93b203a46f071230946d4754895bfc02f6a8eccb
| 7,275
|
exs
|
Elixir
|
bench.exs
|
ckampfe/cbuf
|
7d9ac46558303cbf1aa421691c487ffe66227771
|
[
"MIT"
] | 9
|
2018-01-27T22:27:32.000Z
|
2019-09-06T21:13:44.000Z
|
bench.exs
|
ckampfe/cbuf
|
7d9ac46558303cbf1aa421691c487ffe66227771
|
[
"MIT"
] | 2
|
2018-02-06T06:02:45.000Z
|
2018-03-06T03:43:58.000Z
|
bench.exs
|
ckampfe/cbuf
|
7d9ac46558303cbf1aa421691c487ffe66227771
|
[
"MIT"
] | 1
|
2019-09-24T10:16:02.000Z
|
2019-09-24T10:16:02.000Z
|
small = 50
medium = 5000
large = 50_000
IO.puts("Small N: #{small}")
IO.puts("Medium N: #{medium}")
IO.puts("Small N: #{large}")
map_small = Cbuf.Map.new(small)
map_medium = Cbuf.Map.new(medium)
map_large = Cbuf.Map.new(large)
ets_small = Cbuf.ETS.new(small)
ets_medium = Cbuf.ETS.new(medium)
ets_large = Cbuf.ETS.new(large)
queue_small = Cbuf.Queue.new(small)
queue_medium = Cbuf.Queue.new(medium)
queue_large = Cbuf.Queue.new(large)
str = "ok"
map_filled_small = Enum.reduce(1..small, map_small, fn(val, buf) -> Cbuf.Map.insert(buf, val) end)
map_filled_medium = Enum.reduce(1..medium, map_medium, fn(val, buf) -> Cbuf.Map.insert(buf, val) end)
map_filled_large = Enum.reduce(1..large, map_large, fn(val, buf) -> Cbuf.Map.insert(buf, val) end)
ets_filled_small = Enum.reduce(1..small, ets_small, fn(val, buf) -> Cbuf.ETS.insert(buf, val) end)
ets_filled_medium = Enum.reduce(1..medium, ets_medium, fn(val, buf) -> Cbuf.ETS.insert(buf, val) end)
ets_filled_large = Enum.reduce(1..large, ets_large, fn(val, buf) -> Cbuf.ETS.insert(buf, val) end)
queue_filled_small = Enum.reduce(1..small, queue_small, fn(val, buf) -> Cbuf.Queue.insert(buf, val) end)
queue_filled_medium = Enum.reduce(1..medium, queue_medium, fn(val, buf) -> Cbuf.Queue.insert(buf, val) end)
queue_filled_large = Enum.reduce(1..large, queue_large, fn(val, buf) -> Cbuf.Queue.insert(buf, val) end)
benchmarks = %{
"map insert small" => fn -> Cbuf.Map.insert(map_small, str) end,
"map insert medium" => fn -> Cbuf.Map.insert(map_medium, str) end,
"map insert large" => fn -> Cbuf.Map.insert(map_large, str) end,
"map to_list small" => fn -> Cbuf.Map.to_list(map_filled_small) end,
"map to_list medium" => fn -> Cbuf.Map.to_list(map_filled_medium) end,
"map to_list large" => fn -> Cbuf.Map.to_list(map_filled_large) end,
"map new small" => fn -> Cbuf.Map.new(small) end,
"map new medium" => fn -> Cbuf.Map.new(medium) end,
"map new large" => fn -> Cbuf.Map.new(large) end,
"map peek small" => fn -> Cbuf.Map.peek(map_small) end,
"map peek medium" => fn -> Cbuf.Map.peek(map_medium) end,
"map peek large" => fn -> Cbuf.Map.peek(map_large) end,
"map size small" => fn -> Cbuf.Map.size(map_small) end,
"map size medium" => fn -> Cbuf.Map.size(map_medium) end,
"map size large" => fn -> Cbuf.Map.size(map_large) end,
"map count small" => fn -> Cbuf.Map.count(map_small) end,
"map count medium" => fn -> Cbuf.Map.count(map_medium) end,
"map count large" => fn -> Cbuf.Map.count(map_large) end,
"map delete small" => fn -> Cbuf.Map.delete(map_small) end,
"map delete medium" => fn -> Cbuf.Map.delete(map_medium) end,
"map delete large" => fn -> Cbuf.Map.delete(map_large) end,
"map pop small" => fn -> Cbuf.Map.pop(map_small) end,
"map pop medium" => fn -> Cbuf.Map.pop(map_medium) end,
"map pop large" => fn -> Cbuf.Map.pop(map_large) end,
"map empty? small" => fn -> Cbuf.Map.empty?(map_small) end,
"map empty? medium" => fn -> Cbuf.Map.empty?(map_medium) end,
"map empty? large" => fn -> Cbuf.Map.empty?(map_large) end,
"map member? small" => fn -> Cbuf.Map.member?(map_small, 3) end,
"map member? medium" => fn -> Cbuf.Map.member?(map_medium, 300) end,
"map member? large" => fn -> Cbuf.Map.member?(map_large, 30000) end,
"ets insert small" => fn -> Cbuf.ETS.insert(ets_small, str) end,
"ets insert medium" => fn -> Cbuf.ETS.insert(ets_medium, str) end,
"ets insert large" => fn -> Cbuf.ETS.insert(ets_large, str) end,
"ets to_list small" => fn -> Cbuf.ETS.to_list(ets_filled_small) end,
"ets to_list medium" => fn -> Cbuf.ETS.to_list(ets_filled_medium) end,
"ets to_list large" => fn -> Cbuf.ETS.to_list(ets_filled_large) end,
"ets new small" => fn -> Cbuf.ETS.new(small) end,
"ets new medium" => fn -> Cbuf.ETS.new(medium) end,
"ets new large" => fn -> Cbuf.ETS.new(large) end,
"ets peek small" => fn -> Cbuf.ETS.peek(ets_small) end,
"ets peek medium" => fn -> Cbuf.ETS.peek(ets_medium) end,
"ets peek large" => fn -> Cbuf.ETS.peek(ets_large) end,
"ets size small" => fn -> Cbuf.ETS.size(ets_small) end,
"ets size medium" => fn -> Cbuf.ETS.size(ets_medium) end,
"ets size large" => fn -> Cbuf.ETS.size(ets_large) end,
"ets count small" => fn -> Cbuf.ETS.count(ets_small) end,
"ets count medium" => fn -> Cbuf.ETS.count(ets_medium) end,
"ets count large" => fn -> Cbuf.ETS.count(ets_large) end,
"ets delete small" => fn -> Cbuf.ETS.delete(ets_small) end,
"ets delete medium" => fn -> Cbuf.ETS.delete(ets_medium) end,
"ets delete large" => fn -> Cbuf.ETS.delete(ets_large) end,
"ets pop small" => fn -> Cbuf.ETS.pop(ets_small) end,
"ets pop medium" => fn -> Cbuf.ETS.pop(ets_medium) end,
"ets pop large" => fn -> Cbuf.ETS.pop(ets_large) end,
"ets empty? small" => fn -> Cbuf.ETS.empty?(ets_small) end,
"ets empty? medium" => fn -> Cbuf.ETS.empty?(ets_medium) end,
"ets empty? large" => fn -> Cbuf.ETS.empty?(ets_large) end,
"ets member? small" => fn -> Cbuf.ETS.member?(ets_small, 3) end,
"ets member? medium" => fn -> Cbuf.ETS.member?(ets_medium, 30) end,
"ets member? large" => fn -> Cbuf.ETS.member?(ets_large, 300) end,
"queue insert small" => fn -> Cbuf.Queue.insert(queue_small, str) end,
"queue insert medium" => fn -> Cbuf.Queue.insert(queue_medium, str) end,
"queue insert large" => fn -> Cbuf.Queue.insert(queue_large, str) end,
"queue to_list small" => fn -> Cbuf.Queue.to_list(queue_filled_small) end,
"queue to_list medium" => fn -> Cbuf.Queue.to_list(queue_filled_medium) end,
"queue to_list large" => fn -> Cbuf.Queue.to_list(queue_filled_large) end,
"queue new small" => fn -> Cbuf.Queue.new(small) end,
"queue new medium" => fn -> Cbuf.Queue.new(medium) end,
"queue new large" => fn -> Cbuf.Queue.new(large) end,
"queue peek small" => fn -> Cbuf.Queue.peek(queue_small) end,
"queue peek medium" => fn -> Cbuf.Queue.peek(queue_medium) end,
"queue peek large" => fn -> Cbuf.Queue.peek(queue_large) end,
"queue size small" => fn -> Cbuf.Queue.size(queue_small) end,
"queue size medium" => fn -> Cbuf.Queue.size(queue_medium) end,
"queue size large" => fn -> Cbuf.Queue.size(queue_large) end,
"queue count small" => fn -> Cbuf.Queue.count(queue_small) end,
"queue count medium" => fn -> Cbuf.Queue.count(queue_medium) end,
"queue count large" => fn -> Cbuf.Queue.count(queue_large) end,
"queue delete small" => fn -> Cbuf.Queue.delete(queue_small) end,
"queue delete medium" => fn -> Cbuf.Queue.delete(queue_medium) end,
"queue delete large" => fn -> Cbuf.Queue.delete(queue_large) end,
"queue pop small" => fn -> Cbuf.Queue.pop(queue_small) end,
"queue pop medium" => fn -> Cbuf.Queue.pop(queue_medium) end,
"queue pop large" => fn -> Cbuf.Queue.pop(queue_large) end,
"queue empty? small" => fn -> Cbuf.Queue.empty?(queue_small) end,
"queue empty? medium" => fn -> Cbuf.Queue.empty?(queue_medium) end,
"queue empty? large" => fn -> Cbuf.Queue.empty?(queue_large) end,
"queue member? small" => fn -> Cbuf.Queue.member?(queue_small, 3) end,
"queue member? medium" => fn -> Cbuf.Queue.member?(queue_medium, 300) end,
"queue member? large" => fn -> Cbuf.Queue.member?(queue_large, 30000) end,
}
Benchee.run(
benchmarks,
print: [fast_warning: false],
time: 5,
memory_time: 3
)
| 44.907407
| 107
| 0.667904
|
93b208998c1f8de253830ee0887cc2b11e7efb6d
| 3,096
|
ex
|
Elixir
|
lib/glimesh_web.ex
|
MemoryLeakDeath/glimesh.tv
|
1462c4b939da899f5e3f67c3f28850025d59a10f
|
[
"MIT"
] | null | null | null |
lib/glimesh_web.ex
|
MemoryLeakDeath/glimesh.tv
|
1462c4b939da899f5e3f67c3f28850025d59a10f
|
[
"MIT"
] | null | null | null |
lib/glimesh_web.ex
|
MemoryLeakDeath/glimesh.tv
|
1462c4b939da899f5e3f67c3f28850025d59a10f
|
[
"MIT"
] | null | null | null |
defmodule GlimeshWeb 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 GlimeshWeb, :controller
use GlimeshWeb, :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: GlimeshWeb
import Plug.Conn
import GlimeshWeb.Gettext
alias GlimeshWeb.Router.Helpers, as: Routes
import Glimesh.Formatters
def unauthorized(conn) do
conn
|> put_status(403)
|> send_resp(403, "Unauthorized")
|> halt()
end
end
end
def view do
quote do
use Phoenix.View,
root: "lib/glimesh_web/templates",
namespace: GlimeshWeb
# Import convenience functions from controllers
import Phoenix.Controller,
only: [
get_flash: 1,
get_flash: 2,
view_module: 1,
view_template: 1,
action_name: 1,
controller_module: 1
]
import Glimesh.Formatters
# Include shared imports and aliases for views
unquote(view_helpers())
end
end
def live_view do
quote do
use Phoenix.LiveView,
layout: {GlimeshWeb.LayoutView, "live.html"}
import Glimesh.Formatters
unquote(view_helpers())
end
end
def surface_live_view do
quote do
use Surface.LiveView,
layout: {GlimeshWeb.LayoutView, "live.html"}
import Glimesh.Formatters
unquote(view_helpers())
end
end
def live_component do
quote do
use Phoenix.LiveComponent
import Glimesh.Formatters
unquote(view_helpers())
end
end
def surface_live_component do
quote do
use Surface.LiveComponent
import Glimesh.Formatters
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 GlimeshWeb.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 GlimeshWeb.LiveHelpers
# Import basic rendering functionality (render, render_layout, etc)
import Phoenix.View
import GlimeshWeb.ErrorHelpers
import GlimeshWeb.Gettext
alias GlimeshWeb.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
| 21.061224
| 78
| 0.6573
|
93b2567f670a7481b6441bd683adb38c63d7006b
| 80
|
exs
|
Elixir
|
phoenix_in_action/ch7/auction_umbrella/apps/auction_web/test/auction_web/views/page_view_test.exs
|
jim80net/elixir_tutorial_projects
|
db19901a9305b297faa90642bebcc08455621b52
|
[
"Unlicense"
] | 5
|
2021-11-17T04:37:39.000Z
|
2022-01-02T06:43:23.000Z
|
phoenix_in_action/ch7/auction_umbrella/apps/auction_web/test/auction_web/views/page_view_test.exs
|
jim80net/elixir_tutorial_projects
|
db19901a9305b297faa90642bebcc08455621b52
|
[
"Unlicense"
] | 3
|
2021-05-21T21:50:11.000Z
|
2021-11-21T14:34:53.000Z
|
phoenix_in_action/ch7/auction_umbrella/apps/auction_web/test/auction_web/views/page_view_test.exs
|
jim80net/elixir_tutorial_projects
|
db19901a9305b297faa90642bebcc08455621b52
|
[
"Unlicense"
] | 2
|
2021-11-16T14:14:05.000Z
|
2021-12-31T02:01:06.000Z
|
defmodule AuctionWeb.PageViewTest do
use AuctionWeb.ConnCase, async: true
end
| 20
| 38
| 0.825
|
93b25a0d12bb369c2df84854b57a9f7d8c3a3139
| 2,092
|
ex
|
Elixir
|
web/controllers/format_controller.ex
|
allen-garvey/artour
|
fce27b234d11a3e434c897b5fa3178b7c126245f
|
[
"MIT"
] | 4
|
2019-10-04T16:11:15.000Z
|
2021-08-18T21:00:13.000Z
|
apps/artour/web/controllers/format_controller.ex
|
allen-garvey/phoenix-umbrella
|
1d444bbd62a5e7b5f51d317ce2be71ee994125d5
|
[
"MIT"
] | 5
|
2020-03-16T23:52:25.000Z
|
2021-09-03T16:52:17.000Z
|
apps/artour/web/controllers/format_controller.ex
|
allen-garvey/phoenix-umbrella
|
1d444bbd62a5e7b5f51d317ce2be71ee994125d5
|
[
"MIT"
] | null | null | null |
defmodule Artour.FormatController do
use Artour.Web, :controller
alias Artour.Format
alias Artour.Admin
def index(conn, _params) do
formats = Admin.list_formats()
view = view_module(conn)
put_view(conn, Artour.SharedView) |>
render("index.html", items: formats, item_name_singular: "format", column_headings: view.attribute_names(), item_view: view,
row_values_func_name: :attribute_values)
end
def new(conn, _params) do
changeset = Format.changeset(%Format{})
render(conn, "new.html", changeset: changeset)
end
def create(conn, %{"format" => format_params}) do
changeset = Format.changeset(%Format{}, format_params)
case Repo.insert(changeset) do
{:ok, _format} ->
conn
|> put_flash(:info, "Format created successfully.")
|> redirect(to: format_path(conn, :index))
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
end
end
def show(conn, %{"id" => id}) do
format = Repo.get!(Format, id)
render(conn, "show.html", format: format)
end
def edit(conn, %{"id" => id}) do
format = Repo.get!(Format, id)
changeset = Format.changeset(format)
render(conn, "edit.html", format: format, changeset: changeset)
end
def update(conn, %{"id" => id, "format" => format_params}) do
format = Repo.get!(Format, id)
changeset = Format.changeset(format, format_params)
case Repo.update(changeset) do
{:ok, format} ->
conn
|> put_flash(:info, "Format updated successfully.")
|> redirect(to: format_path(conn, :show, format))
{:error, changeset} ->
render(conn, "edit.html", format: format, changeset: changeset)
end
end
def delete(conn, %{"id" => id}) do
format = Repo.get!(Format, id)
# Here we use delete! (with a bang) because we expect
# it to always work (and if it does not, it will raise).
Repo.delete!(format)
conn
|> put_flash(:info, "Format deleted successfully.")
|> redirect(to: format_path(conn, :index))
end
end
| 29.885714
| 130
| 0.632887
|
93b2c7174bf8a6985b01b4f31ad9e127cd61afef
| 17,551
|
ex
|
Elixir
|
lib/coherence/schema.ex
|
thefuture2092/coherence
|
377d91ff01622773b5a9ec39fadf1f8c27328879
|
[
"MIT"
] | 8
|
2019-01-15T08:57:07.000Z
|
2020-08-26T13:43:01.000Z
|
lib/coherence/schema.ex
|
thefuture2092/coherence
|
377d91ff01622773b5a9ec39fadf1f8c27328879
|
[
"MIT"
] | 2
|
2019-05-29T17:49:10.000Z
|
2019-06-18T21:39:22.000Z
|
lib/coherence/schema.ex
|
thefuture2092/coherence
|
377d91ff01622773b5a9ec39fadf1f8c27328879
|
[
"MIT"
] | 22
|
2018-12-10T02:15:18.000Z
|
2020-10-06T08:42:22.000Z
|
defmodule Coherence.Schema do
@moduledoc """
Add Coherence support to a User schema module.
Add `use Coherence.Schema, opts \\ []` to your User module to add a number of
Module functions and helpers.
The optional `opt` parameter can be used to disable options enabled in the
global configuration by passing `option: false`
For example,
defmodule MyProject.User do
use MyProject.Web, :model
use Coherence.Schema, invitable: false
The following functions are added regardless of the options configured:
* `authenticatable?/0` - Returns true if the option is configured.
* `registerable?/0` - Returns true if the option is configured.
* `confirmable?/0` - Returns true if the option is configured.
* `trackable?/0` - Returns true if the option is configured.
* `trackable_table?/0` - Returns true if the option is configured.
* `recoverable?/0` - Returns true if the option is configured.
* `lockable?/0` - Returns true if the option is configured.
* `invitable?/0` - Returns true if the option is configured.
* `unlockable_with_token?/0` - Returns true if the option is configured.
The following functions are available when `authenticatable?/0` returns true:
* `checkpw/2` - Validate password.
* `encrypt_password/1` - encrypted a password using `<password_hashing_alg>.hashpwsalt`
* `validate_coherence/2` - run the coherence password validations.
* `validate_password/2` - Used by `validate_coherence for password validation`
The following functions are available when `confirmable?/0` returns true.
* `confirmed?/1` - Has the given user been confirmed?
* `confirm/1` - Return a changeset to confirm the given user
The following functions are available when `lockable?/0` returns true.
* `locked?/1` - Is the given user locked?
* `lock/1` - Return a changeset to lock the given user
* `unlock/1` - Return a changeset to unlock the given user
The `coherence_schema/1` macro is used to add the configured schema fields to the User models schema.
The `coherence_fields/0` function is used to return the validation fields appropriate for the selected options.
## Examples:
The following is an example User module when the :authenticatable is used:
defmodule MyProject.User do
use MyProject.Web, :model
use Coherence.Schema
schema "users" do
field :name, :string
field :email, :string
coherence_schema
timestamps
end
@required_fields ~w(name email)
@optional_fields ~w() ++ coherence_fields
def changeset(model, params \\ %{}) do
model
|> cast(params, @required_fields, @optional_fields)
|> unique_constraint(:email)
|> validate_coherence(params)
end
def changeset(model, params, :password) do
model
|> cast(params, ~w(password password_confirmation reset_password_token reset_password_sent_at))
|> validate_coherence_password_reset(params)
end
end
## Configurable confirmable
You may have an application that has its own setting for enabling/disabling confirmable
accounts at runtime. To enable this:
defmodule MyProject.User do
use MyProject.Web, :model
use Coherence.Schema
# ...
def confirmable? do
# test if confirmation is enable
end
def changeset(schema, params) do
schema
|> cast(params, @all_params ++ coherence_fields())
# ...
|> prepare_changes(&prepare_confirmation/1)
end
def prepare_confirmation(%{valid?: true} = changeset) do
if local_settings_require_confirmation? do
changeset
else
changeset
|> put_change(:confirmed_at, NaiveDateTime.utc_now())
|> put_change(:confirmation_token, nil)
end
end
def prepare_confirmation(changeset) do
changeset
end
end
"""
use Coherence.Config
@registration_permitted_attributes [
"email",
"name",
"password",
"current_password",
"password_confirmation"
]
@invitation_permitted_attributes ["name", "email"]
@password_reset_permitted_attributes [
"reset_password_token",
"password",
"password_confirmation"
]
@session_permitted_attributes ["remember", "email", "password"]
defmacro __using__(opts \\ []) do
quote do
import unquote(__MODULE__)
import Ecto.Changeset
alias Coherence.Messages
alias Coherence.{ConfirmableService}
use Coherence.Config
use ConfirmableService, unquote(opts)
require Logger
def authenticatable? do
Coherence.Config.has_option(:authenticatable) and
Keyword.get(unquote(opts), :authenticatable, true)
end
def registerable? do
Coherence.Config.has_option(:registerable) and
Keyword.get(unquote(opts), :registerable, true)
end
def trackable? do
Coherence.Config.has_option(:trackable) and Keyword.get(unquote(opts), :trackable, true)
end
def trackable_table? do
Coherence.Config.has_option(:trackable_table) and
Keyword.get(unquote(opts), :trackable_table, true)
end
def recoverable? do
Coherence.Config.has_option(:recoverable) and
Keyword.get(unquote(opts), :recoverable, true)
end
def lockable? do
Coherence.Config.has_option(:lockable) and Keyword.get(unquote(opts), :lockable, true)
end
def invitable? do
Coherence.Config.has_option(:invitable) and Keyword.get(unquote(opts), :invitable, true)
end
def unlockable_with_token? do
Coherence.Config.has_option(:unlockable_with_token) and
Keyword.get(unquote(opts), :unlockable_with_token, true)
end
def rememberable? do
Coherence.Config.has_option(:rememberable) and
Keyword.get(unquote(opts), :rememberable, true)
end
if Coherence.Config.has_option(:lockable) and Keyword.get(unquote(opts), :lockable, true) do
@doc """
Checks if the user is locked.
Returns true if locked, false otherwise
"""
def locked?(user) do
!!user.locked_at and
!Coherence.Controller.expired?(
user.locked_at,
minutes: Config.unlock_timeout_minutes()
)
end
@doc """
Unlock a user account.
Clears the `:locked_at` field on the user model.
Returns a changeset ready for Repo.update
"""
def unlock(user) do
Config.user_schema().changeset(user, %{
locked_at: nil,
unlock_token: nil,
failed_attempts: 0
})
end
@doc """
Unlock a user account.
Clears the `:locked_at` field on the user model.
deprecated! Please use Coherence.ControllerHelpers.unlock!/1.
"""
def unlock!(user) do
IO.warn(
"#{inspect(Config.user_schema())}.unlock!/1 has been deprecated. Please use Coherence.ControllerHelpers.unlock!/1 instead."
)
changeset = unlock(user)
if locked?(user) do
Config.repo().update(changeset)
else
changeset =
Ecto.Changeset.add_error(changeset, :locked_at, Messages.backend().not_locked())
{:error, changeset}
end
end
@doc """
Lock a use account.
Sets the `:locked_at` field on the user model to the current date and time unless
provided a value for the optional parameter.
You can provide a date in the future to override the configured lock expiry time. You
can set this data far in the future to do a pseudo permanent lock.
Returns a changeset ready for Repo.update
"""
def lock(user, locked_at \\ NaiveDateTime.utc_now()) do
Config.user_schema().changeset(user, %{locked_at: locked_at})
end
@doc """
Lock a use account.
Sets the `:locked_at` field on the user model to the current date and time unless
provided a value for the optional parameter.
You can provide a date in the future to override the configured lock expiry time. You
can set this data far in the future to do a pseudo permanent lock.
deprecated! Please use Coherence.ControllerHelpers.lock!/1.
"""
def lock!(user, locked_at \\ NaiveDateTime.utc_now()) do
IO.warn(
"#{inspect(Config.user_schema())}.lock!/1 has been deprecated. Please use Coherence.ControllerHelpers.lock!/1 instead."
)
changeset = Config.user_schema().changeset(user, %{locked_at: locked_at})
if locked?(user) do
changeset =
Ecto.Changeset.add_error(changeset, :locked_at, Messages.backend().already_locked())
{:error, changeset}
else
Config.repo().update(changeset)
end
end
end
if Coherence.Config.has_option(:authenticatable) and
Keyword.get(unquote(opts), :authenticatable, true) do
def checkpw(password, encrypted) do
try do
apply(Config.password_hashing_alg(), :checkpw, [password, encrypted])
rescue
_ -> false
end
end
defoverridable checkpw: 2
def encrypt_password(password) do
apply(Config.password_hashing_alg(), :hashpwsalt, [password])
end
def validate_coherence(changeset, params) do
changeset
|> validate_length(:password, min: Config.minimum_password_length())
|> validate_current_password(params)
|> validate_password(params)
end
def validate_coherence_password_reset(changeset, params) do
changeset
|> validate_length(:password, min: Config.minimum_password_length())
|> validate_password(params)
end
def validate_current_password(changeset, params) do
current_password = params[:current_password] || params["current_password"]
# current_password_required? = Config.require_current_password and
# (not is_nil(changeset.data.id)) and Map.has_key?(changeset.changes, :password)
# with true <- current_password_required?,
# true <- if(current_password, do: true, else: {:error, "can't be blank"}),
# true <-
# if(checkpw(current_password, Map.get(changeset.data, Config.password_hash), do: true, else: "invalid current password") do
if Config.require_current_password() and not is_nil(changeset.data.id) and
Map.has_key?(changeset.changes, :password) do
if is_nil(current_password) do
add_error(changeset, :current_password, Messages.backend().cant_be_blank())
else
if not checkpw(current_password, Map.get(changeset.data, Config.password_hash())) do
add_error(
changeset,
:current_password,
Messages.backend().invalid_current_password()
)
else
changeset
end
end
else
changeset
end
end
def validate_password(changeset, params) do
if is_nil(Map.get(changeset.data, Config.password_hash())) and
is_nil(changeset.changes[:password]) do
add_error(changeset, :password, Messages.backend().cant_be_blank())
else
changeset
|> validate_confirmation(:password)
|> set_password(params)
end
end
defp set_password(changeset, _params) do
if changeset.valid? and not is_nil(changeset.changes[:password]) do
put_change(
changeset,
Config.password_hash(),
encrypt_password(changeset.changes[:password])
)
else
changeset
end
end
else
def validate_coherence(changeset, _params), do: changeset
end
end
end
@doc """
Add configure schema fields.
Adds the schema fields to the schema block for the options selected.
Only the fields for configured options are added.
For example, for `Coherence.Config.opts == [:authenticatable, :recoverable]`
`coherence_schema` used in the following context:
defmodule MyProject.User do
use MyProject.Web, :model
use Coherence.Schema
schema "users" do
field :name, :string
field :email, :string
coherence_schema
timestamps
end
Will compile a schema to the following:
defmodule MyProject.User do
use MyProject.Web, :model
use Coherence.Schema
schema "users" do
field :name, :string
field :email, :string
field :active, :boolean, default: true
# authenticatable
field :password_hash, :string
field :password, :string, virtual: true
field :password_confirmation, :string, virtual: true
# recoverable
field :reset_password_token, :string
field :reset_password_sent_at, NaiveDateTime
timestamps
end
"""
defmacro coherence_schema do
quote do
if Coherence.Config.has_option(:authenticatable) do
field(Config.password_hash(), :string)
field(:current_password, :string, virtual: true)
field(:password, :string, virtual: true)
field(:password_confirmation, :string, virtual: true)
if Coherence.Config.user_active_field() do
field(:active, :boolean, default: true)
end
end
if Coherence.Config.has_option(:recoverable) do
field(:reset_password_token, :string)
field(:reset_password_sent_at, :naive_datetime)
end
if Coherence.Config.has_option(:rememberable) do
field(:remember_created_at, :naive_datetime)
end
if Coherence.Config.has_option(:trackable) do
field(:sign_in_count, :integer, default: 0)
field(:current_sign_in_at, :naive_datetime)
field(:last_sign_in_at, :naive_datetime)
field(:current_sign_in_ip, :string)
field(:last_sign_in_ip, :string)
end
if Coherence.Config.has_option(:trackable_table) do
has_many(:trackables, Module.concat(Config.module(), Coherence.Trackable))
end
if Coherence.Config.has_option(:lockable) do
field(:failed_attempts, :integer, default: 0)
field(:locked_at, :naive_datetime)
end
if Coherence.Config.has_option(:unlockable_with_token) do
field(:unlock_token, :string)
end
if Coherence.Config.has_option(:confirmable) do
field(:confirmation_token, :string)
field(:confirmed_at, :naive_datetime)
field(:confirmation_sent_at, :naive_datetime)
if Coherence.Config.get(:confirm_email_updates) do
field(:unconfirmed_email, :string)
end
end
end
end
@optional_fields %{
authenticatable: ~w(#{Config.password_hash()} password password_confirmation),
recoverable: ~w(reset_password_token reset_password_sent_at),
rememberable: ~w(remember_created_at),
trackable:
~w(sign_in_count current_sign_in_at last_sign_in_at current_sign_in_ip last_sign_in_ip),
lockable: ~w(locked_at failed_attempts),
unlockable_with_token: ~w(unlock_token),
confirmable: ~w(confirmation_token confirmed_at confirmation_sent_at)
}
@doc """
Get a list of the configured database fields.
Returns a list of fields that can be appended to your @option_fields used
in your models changeset cast.
For example, for `Coherence.Config.opts == [:authenticatable, :recoverable]`
`coherence_fields/0` will return:
~w(password_hash password password_confirmation reset_password_token reset_password_sent_at)
"""
def coherence_fields do
[]
|> options_fields(:authenticatable)
|> options_fields(:recoverable)
|> options_fields(:rememberable)
|> options_fields(:trackable)
|> options_fields(:lockable)
|> options_fields(:unlockable_with_token)
|> options_fields(:confirmable)
|> Enum.map(&String.to_atom/1)
end
defp options_fields(fields, :authenticatable = key) do
fields ++
cond do
not Coherence.Config.has_option(key) ->
[]
Coherence.Config.user_active_field() ->
["active" | @optional_fields[key]]
true ->
@optional_fields[key]
end
end
defp options_fields(fields, key) do
if Coherence.Config.has_option(key) do
fields ++ @optional_fields[key]
else
fields
end
end
@doc """
Default permitted attributes used when they are not configured.
Defaults to be used when the entry is not found in configuration. These are
mainly used when a pre 0.5.1 project is updated.
"""
def permitted_attributes_default(:registration),
do: @registration_permitted_attributes
def permitted_attributes_default(:invitation),
do: @invitation_permitted_attributes
def permitted_attributes_default(:password_reset),
do: @password_reset_permitted_attributes
def permitted_attributes_default(:session),
do: @session_permitted_attributes
end
| 31.852995
| 140
| 0.642926
|
93b2db6c4e67c95e7c5b22557834f2d92adea33b
| 396,078
|
ex
|
Elixir
|
clients/health_care/lib/google_api/health_care/v1beta1/api/projects.ex
|
kaaboaye/elixir-google-api
|
1896784c4342151fd25becd089a5beb323eff567
|
[
"Apache-2.0"
] | null | null | null |
clients/health_care/lib/google_api/health_care/v1beta1/api/projects.ex
|
kaaboaye/elixir-google-api
|
1896784c4342151fd25becd089a5beb323eff567
|
[
"Apache-2.0"
] | null | null | null |
clients/health_care/lib/google_api/health_care/v1beta1/api/projects.ex
|
kaaboaye/elixir-google-api
|
1896784c4342151fd25becd089a5beb323eff567
|
[
"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()}
| {:error, Tesla.Env.t()}
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)
})
|> 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`) - 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.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()}
| {:error, Tesla.Env.t()}
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.
A Google Cloud Platform project can contain up to 500 datasets across all
regions.
## 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()}
| {:error, Tesla.Env.t()}
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.
If errors occur,
error
details field type is
DeidentifyErrorDetails.
Errors are also logged to Stackdriver Logging. For more information,
see [Viewing logs](/healthcare/docs/how-tos/stackdriver-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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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.
* `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()}
| {:error, Tesla.Env.t()}
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. Capped to 100 if not specified.
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()}
| {:error, Tesla.Env.t()}
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`. Output only. 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
## 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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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 """
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.
* `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()}
| {:error, Tesla.Env.t()}
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 """
Sets the access control policy on the specified resource. Replaces any
existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
## 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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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 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()}
| {:error, Tesla.Env.t()}
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. If errors occur,
error
details field type is
DeidentifyErrorDetails.
Errors are also logged to Stackdriver
(see [Viewing logs](/healthcare/docs/how-tos/stackdriver-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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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.
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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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.
* `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()}
| {:error, Tesla.Env.t()}
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.
For errors, the Operation is populated with error details (in the form
of ImportDicomDataErrorDetails in error.details), which hold
finer-grained error information. Errors are also logged to Stackdriver
Logging. For more information,
see [Viewing logs](/healthcare/docs/how-tos/stackdriver-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()}
| {:error, Tesla.Env.t()}
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. Syntax:
https://cloud.google.com/appengine/docs/standard/python/search/query_strings
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 zero the default page size of 100 is used.
* `: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()}
| {:error, Tesla.Env.t()}
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`. Output only. 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6.
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6.
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6.
## 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()}
| {:error, Tesla.Env.t()}
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 Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.5.
## 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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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. Delete requests
are equivalent to the GET requests specified in the Retrieve transaction.
## 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.Empty{}}` 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.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 """
RetrieveStudyMetadata returns instance associated with the given study
presented as metadata with the bulk data removed. See
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6.
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6.
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.5.
## 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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.
Delete requests are equivalent to the GET requests specified in the
Retrieve transaction.
## 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.Empty{}}` 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.Empty.t()}
| {:ok, Tesla.Env.t()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 """
RetrieveSeriesMetadata returns instance associated with the given study and
series, presented as metadata with the bulk data removed. See
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6.
## 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()}
| {:error, Tesla.Env.t()}
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.
## 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4.
## 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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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. If errors occur,
error
details field type is
DeidentifyErrorDetails.
Errors are also logged to Stackdriver
(see [Viewing logs](/healthcare/docs/how-tos/stackdriver-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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 Stackdriver (see [Viewing
logs](/healthcare/docs/how-tos/stackdriver-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. The name should be 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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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.
* `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()}
| {:error, Tesla.Env.t()}
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, and will be
stored using that ID regardless of the
enable_update_create setting on the FHIR
store.
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.
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 will contain 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 will 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 is specified by the parameters
below. 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 Stackdriver (see [Viewing
logs](/healthcare/docs/how-tos/stackdriver-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. The name should be
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()}
| {:error, Tesla.Env.t()}
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. Syntax:
https://cloud.google.com/appengine/docs/standard/python/search/query_strings
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 zero
the default page size of 100 is used.
* `: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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
## 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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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 """
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](http://hl7.org/implement/standards/fhir/STU3/observation-operations.html#lastn),
[R4](http://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 will contain a JSON-encoded representation
of a `Bundle` resource of type `searchset`, containing the results of the
operation.
Errors generated by the FHIR store will 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()}
| {:error, Tesla.Env.t()}
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 """
On success, the response body will contain a JSON-encoded representation
of a `Bundle` resource of type `searchset`, containing the results of the
operation.
Errors generated by the FHIR store will 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`. 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. Defaults to 100.
* `:_page_token` (*type:* `String.t`) - Used to retrieve the next or previous page of results
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.
* `: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()}
| {:error, Tesla.Env.t()}
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,
: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.
## 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()}
| {:error, Tesla.Env.t()}
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 """
Gets the FHIR capability statement
([STU3](http://hl7.org/implement/standards/fhir/STU3/capabilitystatement.html),
[R4](http://hl7.org/implement/standards/fhir/R4/capabilitystatement.html)),
or the [conformance
statement](http://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](http://hl7.org/implement/standards/fhir/STU3/http.html#capabilities),
[R4](http://hl7.org/implement/standards/fhir/R4/http.html#capabilities)),
or the [conformance
interaction](http://hl7.org/implement/standards/fhir/DSTU2/http.html#conformance)
in the DSTU2 case.
On success, the response body will contain 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()}
| {:error, Tesla.Env.t()}
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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.12.1),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.13.1),
[R4](http://hl7.org/implement/standards/fhir/R4/http.html#3.1.0.7.1)).
If multiple resources match, all of them will be 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 will be moved to a history
repository that can still be retrieved through vread
and related methods, unless they are removed by the
purge method.
## 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](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html),
[STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html),
[R4](http://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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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](http://hl7.org/implement/standards/fhir/STU3/http.html#patch),
[R4](http://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 will
return 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 will contain a JSON-encoded representation
of the updated resource, including the server-assigned version ID.
Errors generated by the FHIR store will 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 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](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html),
[STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html),
[R4](http://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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.10.2),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#cond-update),
[R4](http://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 will
return 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. If the search criteria identify zero
matches, and the supplied resource body does not contain an `id`, the
resource will be 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 will contain a JSON-encoded representation
of the updated resource, including the server-assigned version ID.
Errors generated by the FHIR store will 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 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](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html),
[STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html),
[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").
* `: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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#create),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#create),
[R4](http://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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#ccreate),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#ccreate),
[R4](http://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 will contain 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 will 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 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](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html),
[STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html),
[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").
* `: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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#delete),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#delete),
[R4](http://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 will be moved to a history
repository that can still be retrieved through vread
and related methods, unless they are removed by the
purge method.
## 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#transaction),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#transaction),
[R4](http://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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.16.1),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.17.1),
[R4](http://hl7.org/implement/standards/fhir/R4/http.html#brules))
and transaction processing rules
([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.16.2),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.17.2),
[R4](http://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 will
contain 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 will 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 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()}
| {:error, Tesla.Env.t()}
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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#history),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#history),
[R4](http://hl7.org/implement/standards/fhir/R4/http.html#history)).
On success, the response body will contain 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 will 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 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. Defaults to 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()}
| {:error, Tesla.Env.t()}
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](http://hl7.org/implement/standards/fhir/STU3/http.html#patch),
[R4](http://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 will contain a JSON-encoded representation
of the updated resource, including the server-assigned version ID.
Errors generated by the FHIR store will 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 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#read),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#read),
[R4](http://hl7.org/implement/standards/fhir/R4/http.html#read)).
Also supports the FHIR standard conditional read interaction
([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#cread),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#cread),
[R4](http://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 will contain a JSON-encoded representation
of the resource.
Errors generated by the FHIR store will 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 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#search),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#search),
[R4](http://hl7.org/implement/standards/fhir/R4/http.html#search))
using the search semantics described in the FHIR Search specification
([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/search.html),
[STU3](http://hl7.org/implement/standards/fhir/STU3/search.html),
[R4](http://hl7.org/implement/standards/fhir/R4/search.html)).
Supports three 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]/[type]/_search?[parameters]` as an alternate form having
the same semantics as the `GET` method.
The `GET` methods do not support compartment searches. The `POST` method
does not support `application/x-www-form-urlencoded` search parameters.
On success, the response body will contain a JSON-encoded representation
of a `Bundle` resource of type `searchset`, containing the results of the
search.
Errors generated by the FHIR store will 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](http://hl7.org/implement/standards/fhir/STU3/searchparameter-registry.html),
[R4](http://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` will contain
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.
## 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()}
| {:error, Tesla.Env.t()}
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 """
Updates the entire contents of a resource.
Implements the FHIR standard update interaction
([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#update),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#update),
[R4](http://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.
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 will contain a JSON-encoded representation
of the updated resource, including the server-assigned version ID.
Errors generated by the FHIR store will 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 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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](http://hl7.org/implement/standards/fhir/DSTU2/http.html#vread),
[STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#vread),
[R4](http://hl7.org/implement/standards/fhir/R4/http.html#vread)).
On success, the response body will contain a JSON-encoded representation
of the resource.
Errors generated by the FHIR store will 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 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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()}
| {:error, Tesla.Env.t()}
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 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 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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.
* `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()}
| {:error, Tesla.Env.t()}
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 """
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. Syntax:
https://cloud.google.com/appengine/docs/standard/python/search/query_strings
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 zero the default page size of 100 is used.
* `: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()}
| {:error, Tesla.Env.t()}
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`. Output only. 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
## 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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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 """
Creates a message and sends a notification to the Cloud Pub/Sub topic. If
configured, the MLLP adapter listens to messages created by this method and
sends those back to the hospital. A successful response indicates the
message has been persisted to storage and a Cloud Pub/Sub notification has
been sent. Sending to the hospital by the MLLP adapter happens
asynchronously.
## 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()}
| {:error, Tesla.Env.t()}
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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 """
Ingests a new HL7v2 message from the hospital and sends a notification to
the Cloud Pub/Sub topic. Return is an HL7v2 ACK message if the message was
successfully stored. Otherwise an error is returned.
## 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()}
| {:error, Tesla.Env.t()}
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. Syntax:
https://cloud.google.com/appengine/docs/standard/python/search/query_strings
Fields/functions available for filtering are:
* `message_type`, from the MSH-9 segment. 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"`.
* `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":*`.
Limitations on conjunctions:
* Negation on the patient ID function or the labels field is not
supported. For example, these queries are invalid:
`NOT PatientId("123456", "MRN")`, `NOT labels."tag1":*`,
`NOT labels."tag2"="val2"`.
* Conjunction of multiple patient ID functions is not supported, for
example this query is invalid:
`PatientId("123456", "MRN") AND PatientId("456789", "MRN")`.
* Conjunction of multiple labels fields is also not supported, for
example this query is invalid: `labels."tag1":* AND labels."tag2"="val2"`.
* Conjunction of one patient ID function, one labels field and conditions
on other fields is supported. For example, this query is valid:
`PatientId("123456", "MRN") AND labels."tag1":* AND message_type = "ADT"`.
* `: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 zero the default page size of 100 is used.
* `: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.
* `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()}
| {:error, Tesla.Env.t()}
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 cannot 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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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 """
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()}
| {:error, Tesla.Env.t()}
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)
}
)
|> 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()}
| {:error, Tesla.Env.t()}
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
end
| 46.384588
| 213
| 0.62772
|
93b334276d1f3dd5cf7ddcc23755537bd67625e3
| 2,742
|
ex
|
Elixir
|
apps/exth_crypto/lib/exth_crypto/ecies/parameters.ex
|
wolflee/mana
|
db66dac85addfaad98d40da5bd4082b3a0198bb1
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 152
|
2018-10-27T04:52:03.000Z
|
2022-03-26T10:34:00.000Z
|
apps/exth_crypto/lib/exth_crypto/ecies/parameters.ex
|
wolflee/mana
|
db66dac85addfaad98d40da5bd4082b3a0198bb1
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 270
|
2018-04-14T07:34:57.000Z
|
2018-10-25T18:10:45.000Z
|
apps/exth_crypto/lib/exth_crypto/ecies/parameters.ex
|
wolflee/mana
|
db66dac85addfaad98d40da5bd4082b3a0198bb1
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 25
|
2018-10-27T12:15:13.000Z
|
2022-01-25T20:31:14.000Z
|
defmodule ExthCrypto.ECIES.Parameters do
@moduledoc """
Returns one set of the Standard ECIES parameters:
* ECIES using AES128 and HMAC-SHA-256-16
* ECIES using AES256 and HMAC-SHA-256-32
* ECIES using AES256 and HMAC-SHA-384-48
* ECIES using AES256 and HMAC-SHA-512-64
"""
alias ExthCrypto.AES
alias ExthCrypto.Cipher
alias ExthCrypto.Hash
alias ExthCrypto.Hash.SHA
defstruct mac: nil,
hasher: nil,
cipher: nil,
key_len: nil
@type t :: %__MODULE__{
mac: Hash.hash_algorithm(),
hasher: Hash.hash_type(),
cipher: Cipher.cipher(),
key_len: integer()
}
@doc """
Returns curve parameters for ECIES with AES-256 symmetric
encryption and SHA-256 hash.
"""
@spec ecies_aes128_sha256() :: t
def ecies_aes128_sha256 do
%__MODULE__{
mac: :sha256,
hasher: {&SHA.sha256/1, nil, 32},
cipher: {AES, AES.block_size(), :ctr},
key_len: 16
}
end
@doc """
Returns curve parameters for ECIES with AES-256 symmetric
encryption and SHA-256 hash.
"""
@spec ecies_aes256_sha256() :: t
def ecies_aes256_sha256 do
%__MODULE__{
mac: :sha256,
hasher: {&SHA.sha256/1, nil, 32},
cipher: {AES, AES.block_size(), :ctr},
key_len: 32
}
end
@doc """
Returns curve parameters for ECIES with AES-256 symmetric
encryption and SHA-384 hash.
"""
@spec ecies_aes256_sha384() :: t
def ecies_aes256_sha384 do
%__MODULE__{
mac: :sha256,
hasher: {&SHA.sha384/1, nil, 48},
cipher: {AES, AES.block_size(), :ctr},
key_len: 32
}
end
@doc """
Returns curve parameters for ECIES with AES-256 symmetric
encryption and SHA-512 hash.
"""
@spec ecies_aes256_sha512() :: t
def ecies_aes256_sha512 do
%__MODULE__{
mac: :sha256,
hasher: {&SHA.sha512/1, nil, 64},
cipher: {AES, AES.block_size(), :ctr},
key_len: 32
}
end
@doc """
Returns the block size of a given set of ECIES params.
## Examples
iex> ExthCrypto.ECIES.Parameters.block_size(ExthCrypto.ECIES.Parameters.ecies_aes256_sha512)
32
"""
@spec block_size(t) :: integer()
def block_size(params) do
{_, block_size, _args} = params.cipher
block_size
end
@doc """
Returns the hash len of a given set of ECIES params.
## Examples
iex> ExthCrypto.ECIES.Parameters.hash_len(ExthCrypto.ECIES.Parameters.ecies_aes256_sha256)
32
iex> ExthCrypto.ECIES.Parameters.hash_len(ExthCrypto.ECIES.Parameters.ecies_aes256_sha512)
64
"""
@spec hash_len(t) :: integer()
def hash_len(params) do
# Get size of hash cipher
{_, _, hash_len} = params.hasher
hash_len
end
end
| 23.435897
| 98
| 0.63895
|
93b33cf0839a3ee633b9110ec4e677b1d75a8ecd
| 3,544
|
ex
|
Elixir
|
lib/boids/motion.ex
|
aishraj/boids
|
1e58b356be78e58f67c4deb6a2092a0442fe8512
|
[
"MIT"
] | null | null | null |
lib/boids/motion.ex
|
aishraj/boids
|
1e58b356be78e58f67c4deb6a2092a0442fe8512
|
[
"MIT"
] | null | null | null |
lib/boids/motion.ex
|
aishraj/boids
|
1e58b356be78e58f67c4deb6a2092a0442fe8512
|
[
"MIT"
] | null | null | null |
defmodule Boids.Motion do
require Logger
alias Boids.Physics.Vector
@max_speed 10
def applyforce(boid, force) do
%Boids.Boid{
position: boid.position,
velocity: boid.velocity,
accleration: Vector.add(boid.accleration, force)
}
end
def move_boid(boid, others) do
sep = separate(boid, others)
aln = align(boid, others)
coh = coh(boid, others)
Logger.debug(
"Sep Align and Cohesion vectors are #{inspect(sep)} #{inspect(aln)} and #{inspect(coh)}"
)
boid
|> applyforce(sep)
|> applyforce(aln)
|> applyforce(coh)
|> move
end
def separate(%Boids.Boid{} = boid, others) do
# Logger.info("Size of boids in separate is #{length(others)}")
min_space = 10
{steer_vec, count} =
others
|> Enum.filter(fn neighbour ->
distance = Vector.distance(boid.position, neighbour.position)
distance > 0 && distance < min_space
end)
|> Enum.map(fn neighbour ->
Vector.diff(boid.position, neighbour.position)
|> Vector.normalize()
|> Vector.vec_div(Vector.distance(boid.position, neighbour.position))
end)
|> Enum.reduce({Vector.new(0, 0), 0}, fn diff, {s, c} -> {Vector.add(s, diff), c + 1} end)
Logger.debug("Steer and count are #{inspect(steer_vec)} and #{inspect(count)}")
steer =
case count do
0 -> steer_vec
_ -> Vector.vec_div(steer_vec, count)
end
case Vector.magnitude(steer) do
0 ->
steer
_ ->
steer
|> Vector.normalize()
|> Vector.mult(@max_speed)
|> Vector.diff(boid.velocity)
end
end
def align(%Boids.Boid{} = boid, others) do
# Logger.info("Size of boids in align is #{length(others)}")
neighbour_dist = 10
{vec, count} =
others
|> Enum.reduce({Vector.new(), 0}, fn neighbour, {s, c} ->
d = Vector.distance(boid.position, neighbour.position)
if d > 0 && d < neighbour_dist do
{Vector.add(s, neighbour.velocity), c + 1}
else
{s, c}
end
end)
Logger.debug("Align prevec and count are #{inspect({vec, count})}")
case count do
0 ->
Vector.new()
_ ->
vec
|> Vector.vec_div(count)
|> Vector.normalize()
|> Vector.mult(@max_speed)
|> Vector.diff(boid.velocity)
end
end
def coh(%Boids.Boid{} = boid, others) do
# Logger.info("Size of boids in coh is #{length(others)}")
neighbour_dist = 50
{vec, count} =
others
|> Enum.reduce({Vector.new(), 0}, fn neighbour, {s, c} ->
d = Vector.distance(boid.position, neighbour.position)
if d > 0 && d < neighbour_dist do
{Vector.add(s, neighbour.velocity), c + 1}
else
{s, c}
end
end)
case count do
0 ->
Vector.new()
_ ->
vec
|> Vector.vec_div(count)
|> seek(boid)
end
end
def seek(target, %Boids.Boid{} = boid) do
target
|> Vector.diff(boid.position)
|> Vector.normalize()
|> Vector.mult(@max_speed)
|> Vector.diff(boid.velocity)
end
defp move(%Boids.Boid{} = boid) do
future_velocity = Vector.add(boid.velocity, boid.accleration)
Logger.debug("Future velocity is #{inspect(future_velocity)}")
%Boids.Boid{
velocity: Vector.add(boid.velocity, boid.accleration),
position: Vector.add(boid.position, boid.velocity),
# reset to 0
accleration: Vector.new()
}
end
end
| 24.273973
| 96
| 0.576467
|
93b365352f75db38f54854c0dadec0ee05dae274
| 6,563
|
ex
|
Elixir
|
lib/kinesis_client/stream/shard/lease.ex
|
slievr/kcl_ex
|
c1620ba68b56da1802e6e9fafdb3da14155b90d7
|
[
"Apache-2.0"
] | null | null | null |
lib/kinesis_client/stream/shard/lease.ex
|
slievr/kcl_ex
|
c1620ba68b56da1802e6e9fafdb3da14155b90d7
|
[
"Apache-2.0"
] | null | null | null |
lib/kinesis_client/stream/shard/lease.ex
|
slievr/kcl_ex
|
c1620ba68b56da1802e6e9fafdb3da14155b90d7
|
[
"Apache-2.0"
] | null | null | null |
defmodule KinesisClient.Stream.Shard.Lease do
@moduledoc false
require Logger
use GenServer
alias KinesisClient.Stream.AppState
alias KinesisClient.Stream.AppState.ShardLease
alias KinesisClient.Stream.Shard.Pipeline
alias UUID
@default_renew_interval 30_000
# The amount of time that must have elapsed since the least_count was incremented in order to
# consider the lease expired.
@default_lease_expiry 90_001
def start_link(opts) do
GenServer.start_link(__MODULE__, opts, name: name(opts[:shard_id]))
end
defstruct [
:app_name,
:shard_id,
:lease_owner,
:lease_count,
:lease_count_increment_time,
:app_state_opts,
:renew_interval,
:notify,
:lease_expiry,
:lease_holder
]
@type t :: %__MODULE__{}
@impl GenServer
def init(opts) do
state = %__MODULE__{
app_name: opts[:app_name],
shard_id: opts[:shard_id],
lease_owner: opts[:lease_owner],
app_state_opts: Keyword.get(opts, :app_state_opts, []),
renew_interval: Keyword.get(opts, :renew_interval, @default_renew_interval),
lease_expiry: Keyword.get(opts, :lease_expiry, @default_lease_expiry),
lease_count_increment_time: current_time(),
notify: Keyword.get(opts, :notify)
}
Process.send_after(self(), :take_or_renew_lease, state.renew_interval)
Logger.debug("Starting KinesisClient.Stream.Lease: #{inspect(state)}")
{:ok, state, {:continue, :initialize}}
end
@impl GenServer
def handle_continue(:initialize, state) do
new_state =
case get_lease(state) do
:not_found ->
Logger.debug(
"No existing lease record found in AppState: " <>
"[app_name: #{state.app_name}, shard_id: #{state.shard_id}]"
)
create_lease(state)
%ShardLease{} = s ->
take_or_renew_lease(s, state)
end
if new_state.lease_holder do
:ok = Pipeline.start(state.app_name, state.shard_id)
end
notify({:initialized, new_state}, state)
{:noreply, new_state}
end
@impl GenServer
def handle_info(:take_or_renew_lease, state) do
Process.send_after(self(), :take_or_renew_lease, state.renew_interval)
reply =
case get_lease(state) do
%ShardLease{} = s ->
{:noreply, take_or_renew_lease(s, state)}
{:error, e} ->
Logger.error("Error fetching shard #{state.share_id}: #{inspect(e)}")
{:noreply, state}
end
reply
end
@spec take_or_renew_lease(shard_lease :: ShardLease.t(), state :: t()) :: t()
defp take_or_renew_lease(shard_lease, %{lease_expiry: lease_expiry} = state) do
cond do
shard_lease.lease_owner == state.lease_owner ->
renew_lease(shard_lease, state)
current_time() - state.lease_count_increment_time > lease_expiry ->
take_lease(shard_lease, state)
true ->
state =
case shard_lease.lease_count != state.lease_count do
true ->
set_lease_count(shard_lease.lease_count, false, state)
false ->
%{state | lease_holder: false}
end
Logger.debug(
"Lease is owned by another node, and could not be taken: [shard_id: #{state.shard_id}, " <>
"lease_owner: #{state.lease_owner}, lease_count: #{state.lease_count}]"
)
notify({:tracking_lease, state}, state)
state
end
end
defp set_lease_count(lease_count, is_lease_holder, %__MODULE__{} = state) do
%{
state
| lease_count: lease_count,
lease_count_increment_time: current_time(),
lease_holder: is_lease_holder
}
end
defp get_lease(state) do
AppState.get_lease(state.app_name, state.shard_id, state.app_state_opts)
end
@spec create_lease(state :: t()) :: t()
defp create_lease(%{app_state_opts: opts, app_name: app_name, lease_owner: lease_owner} = state) do
Logger.debug(
"Creating lease: [app_name: #{app_name}, shard_id: #{state.shard_id}, lease_owner: " <>
"#{lease_owner}]"
)
case AppState.create_lease(app_name, state.shard_id, lease_owner, opts) do
:ok -> %{state | lease_holder: true, lease_count: 1}
:already_exists -> %{state | lease_holder: false}
end
end
@spec renew_lease(shard_lease :: ShardLease.t(), state :: t()) :: t()
defp renew_lease(shard_lease, %{app_state_opts: opts, app_name: app_name} = state) do
expected = shard_lease.lease_count + 1
Logger.debug(
"Renewing lease: [app_name: #{app_name}, shard_id: #{state.shard_id}, lease_owner: " <>
"#{state.lease_owner}]"
)
case AppState.renew_lease(app_name, shard_lease, opts) do
{:ok, ^expected} ->
state = set_lease_count(expected, true, state)
notify({:lease_renewed, state}, state)
state
:lease_renew_failed ->
Logger.debug(
"Failed to renew lease, stopping producer: [app_name: #{app_name}, " <>
"shard_id: #{state.shard_id}, lease_owner: #{state.lease_owner}]"
)
:ok = Pipeline.stop(app_name, state.shard_id)
%{state | lease_holder: false, lease_count_increment_time: current_time()}
{:error, e} ->
Logger.error("Error trying to renew lease for #{state.shard_id}: #{inspect(e)}")
state
end
end
defp take_lease(shard_lease, %{app_state_opts: opts, app_name: app_name} = state) do
expected = state.lease_count + 1
Logger.debug(
"Attempting to take lease: [lease_owner: #{state.lease_owner}, shard_id: #{state.shard_id}]"
)
case AppState.take_lease(app_name, state.shard_id, state.lease_owner, state.lease_count, opts) do
{:ok, ^expected} ->
state = %{
state
| lease_holder: true,
lease_count: expected,
lease_count_increment_time: current_time()
}
notify({:lease_taken, state}, state)
:ok = Pipeline.start(app_name, state.shard_id)
state
:lease_take_failed ->
# TODO
# :ok = Processor.ensure_halted(state)
%{state | lease_holder: false, lease_count_increment_time: current_time()}
end
end
defp notify(_msg, %{notify: nil}) do
:ok
end
defp notify(msg, %{notify: notify}) do
send(notify, msg)
:ok
end
defp current_time do
System.monotonic_time(:millisecond)
end
def name(shard_id) do
name = Module.concat(__MODULE__, shard_id)
|> Module.concat(UUID.uuid4())
Logger.debug("Shard lease name: #{name}")
name
end
end
| 28.534783
| 101
| 0.643151
|
93b37920bcf748f4dbe235e4fec71db4f3f72a63
| 4,674
|
ex
|
Elixir
|
lib/schatten/workflow/filter.ex
|
ianrumford/harnais_form
|
6b20a762af3921ba4a92e58a5139c8dd190f3bb9
|
[
"MIT"
] | null | null | null |
lib/schatten/workflow/filter.ex
|
ianrumford/harnais_form
|
6b20a762af3921ba4a92e58a5139c8dd190f3bb9
|
[
"MIT"
] | null | null | null |
lib/schatten/workflow/filter.ex
|
ianrumford/harnais_form
|
6b20a762af3921ba4a92e58a5139c8dd190f3bb9
|
[
"MIT"
] | null | null | null |
defmodule Harnais.Form.Schatten.Workflow.Filter do
@moduledoc false
require Plymio.Fontais.Option
alias Harnais.Utility, as: HUU
alias Harnais.Form.Schatten.Workflow.Utility, as: HASWU
use Harnais.Form.Attribute.Schatten
import Harnais.Error,
only: [
new_error_result: 1
],
warn: false
import Harnais.Error,
only: [
new_error_result: 1
],
warn: false
def filter_workflow_pipeline(pipeline, fun_filter \\ nil)
def filter_workflow_pipeline([], _) do
{:ok, []}
end
def filter_workflow_pipeline(pipeline, nil) do
pipeline |> HASWU.validate_workflow_pipeline()
end
def filter_workflow_pipeline(pipeline, fun_filter) when is_function(fun_filter, 1) do
with {:ok, pipeline} <- pipeline |> HASWU.validate_workflow_pipeline(),
{:ok, fun_filter} <-
fun_filter
|> HUU.value_validate_by_predicate(&is_function(&1, 1)) do
pipeline =
pipeline
|> Enum.filter(fun_filter)
{:ok, pipeline}
else
{:error, %{__exception__: true}} = result -> result
end
end
def filter_workflow_pipeline(_value, fun_filter) do
new_error_result(m: "filter function invalid", v: fun_filter)
end
def filter_workflow_pipeline_singleton_entry(pipeline, fun_filter) do
with {:ok, pipeline} <- pipeline |> filter_workflow_pipeline(fun_filter) do
case pipeline |> length do
1 ->
{:ok, pipeline |> hd}
n ->
new_error_result(m: "pipeline entries too few or too many; expected 1", v: n)
end
else
{:error, %{__exception__: true}} = result -> result
end
end
def filter_workflow_pipeline_by_singleton(pipeline) do
with {:ok, pipeline} <- pipeline |> HASWU.validate_workflow_pipeline() do
case pipeline |> length do
1 ->
{:ok, pipeline |> hd}
n ->
new_error_result(m: "pipeline too small or too large; expected 1", v: n)
end
else
{:error, %{__exception__: true}} = result -> result
end
end
def filter_workflow_pipeline_by_index(pipeline, index)
def filter_workflow_pipeline_by_index(pipeline, index) when is_integer(index) do
with {:ok, pipeline} <- pipeline |> HASWU.validate_workflow_pipeline() do
pipeline
|> Enum.at(index, @harnais_form_schatten_value_not_set)
|> case do
@harnais_form_schatten_value_not_set ->
new_error_result(m: "filter index #{inspect(index)} not found", v: pipeline)
value ->
{:ok, value}
end
else
{:error, %{__exception__: true}} = result -> result
end
end
def filter_workflow_pipeline_by_index(_value, index) do
new_error_result(m: "filter index invalid", v: index)
end
def filter_workflow_pipeline_by_verb(pipeline, verb)
def filter_workflow_pipeline_by_verb([], _verb) do
{:ok, []}
end
def filter_workflow_pipeline_by_verb(pipeline, verb) do
pipeline
|> filter_workflow_pipeline(fn
{^verb, _, _} -> true
_ -> false
end)
end
def filter_workflow_pipeline_by_field(pipeline, field)
def filter_workflow_pipeline_by_field([], _field) do
{:ok, []}
end
def filter_workflow_pipeline_by_field(pipeline, field) do
pipeline
|> filter_workflow_pipeline(fn
{_, ^field, _} -> true
_ -> false
end)
end
def filter_workflow_pipeline_by_last_field(pipeline, field) do
with {:ok, pipeline} <- pipeline |> filter_workflow_pipeline_by_field(field) do
{:ok, pipeline |> List.last()}
else
{:error, %{__exception__: true}} = result -> result
end
end
def filter_workflow_pipeline_by_verb_field(pipeline, verb, field) do
with {:ok, pipeline} <- pipeline |> filter_workflow_pipeline_by_verb(verb),
{:ok, _pipeline} = result <- pipeline |> filter_workflow_pipeline_by_field(field) do
result
else
{:error, %{__exception__: true}} = result -> result
end
end
def filter_workflow_pipeline_by_singleton_verb_field(pipeline, verb, field) do
with {:ok, pipeline} <- pipeline |> filter_workflow_pipeline_by_verb_field(verb, field),
{:ok, _tuple} = result <- pipeline |> filter_workflow_pipeline_by_singleton do
result
else
{:error, %{__exception__: true}} = result -> result
end
end
def filter_workflow_pipeline_by_last_verb_field(pipeline, verb, field) do
with {:ok, pipeline} <- pipeline |> filter_workflow_pipeline_by_verb_field(verb, field),
{:ok, _tuple} = result <- pipeline |> filter_workflow_pipeline_by_index(-1) do
result
else
{:error, %{__exception__: true}} = result -> result
end
end
end
| 28.5
| 93
| 0.666881
|
93b37ebdb04d139ee159bf7da534adfeeae38e99
| 1,960
|
ex
|
Elixir
|
clients/dataflow/lib/google_api/dataflow/v1b3/model/list_jobs_response.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | null | null | null |
clients/dataflow/lib/google_api/dataflow/v1b3/model/list_jobs_response.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | null | null | null |
clients/dataflow/lib/google_api/dataflow/v1b3/model/list_jobs_response.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | 1
|
2018-07-28T20:50:50.000Z
|
2018-07-28T20:50:50.000Z
|
# 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.Dataflow.V1b3.Model.ListJobsResponse do
@moduledoc """
Response to a request to list Cloud Dataflow jobs. This may be a partial response, depending on the page size in the ListJobsRequest.
## Attributes
- failedLocation (List[FailedLocation]): Zero or more messages describing locations that failed to respond. Defaults to: `null`.
- jobs (List[Job]): A subset of the requested job information. Defaults to: `null`.
- nextPageToken (String): Set if there may be more results than fit in this response. Defaults to: `null`.
"""
defstruct [
:"failedLocation",
:"jobs",
:"nextPageToken"
]
end
defimpl Poison.Decoder, for: GoogleApi.Dataflow.V1b3.Model.ListJobsResponse do
import GoogleApi.Dataflow.V1b3.Deserializer
def decode(value, options) do
value
|> deserialize(:"failedLocation", :list, GoogleApi.Dataflow.V1b3.Model.FailedLocation, options)
|> deserialize(:"jobs", :list, GoogleApi.Dataflow.V1b3.Model.Job, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.Dataflow.V1b3.Model.ListJobsResponse do
def encode(value, options) do
GoogleApi.Dataflow.V1b3.Deserializer.serialize_non_nil(value, options)
end
end
| 36.981132
| 136
| 0.752041
|
93b38aff7473db448a2174ca597418e69f390be3
| 1,549
|
ex
|
Elixir
|
lib/xgen/options/elixir/std.ex
|
ejpcmac/ex_gen
|
ccd2beec8912fa6ea6ff9839454986bf3124b001
|
[
"MIT"
] | 1
|
2019-10-06T07:31:06.000Z
|
2019-10-06T07:31:06.000Z
|
lib/xgen/options/elixir/std.ex
|
ejpcmac/xgen
|
ccd2beec8912fa6ea6ff9839454986bf3124b001
|
[
"MIT"
] | 30
|
2018-08-29T12:52:59.000Z
|
2020-05-28T04:54:33.000Z
|
lib/xgen/options/elixir/std.ex
|
ejpcmac/ex_gen
|
ccd2beec8912fa6ea6ff9839454986bf3124b001
|
[
"MIT"
] | 1
|
2020-09-25T09:39:56.000Z
|
2020-09-25T09:39:56.000Z
|
defmodule XGen.Options.Elixir.Std do
@moduledoc false
use XGen.Option, collection: true
defoption Release do
defoption ConfigProvider do
key :config_provider
type :choice
default :toml
options choices: config_providers()
name "Distillery “Config Providers”"
prompt "Which Config Provider do you want to use?"
documentation """
You may need to configure your application after it has been compiled,
when deploying your OTP release. Distillery comes with a configuration
framework called “Config Providers”. xgen can generate a template for you
using different config providers.
"""
defp config_providers do
[
toml: "Toml.Provider",
mix: "Mix.Releases.Config.Providers.Elixir",
nil: "Do not use a Config Provider"
]
end
end
key :release?
type :yesno
default :no
options if_yes: [ConfigProvider]
name "Release"
prompt "Generate a release configuration?"
documentation """
xgen can add Distillery to your project and generate a standard release
configuration in rel/config.exs.
"""
end
defoption Package do
key :package?
type :yesno
default :no
name "Package information"
prompt "Add package information?"
documentation """
If you are writing an Elixir library, you may want to publish it with Hex.
In this case, xgen can add package information to the mix.exs so you don’t
have to write it afterwards.
"""
end
end
| 26.706897
| 79
| 0.667527
|
93b38b28ca2fe94ee6cbe4c6c579eb75b6a8e50a
| 1,183
|
ex
|
Elixir
|
lib/filex.ex
|
fteem/filex
|
0de1a330666a53a96e0c754f6e654a1fda2b455c
|
[
"MIT"
] | 2
|
2018-12-17T22:33:39.000Z
|
2018-12-18T09:28:27.000Z
|
lib/filex.ex
|
fteem/filex
|
0de1a330666a53a96e0c754f6e654a1fda2b455c
|
[
"MIT"
] | null | null | null |
lib/filex.ex
|
fteem/filex
|
0de1a330666a53a96e0c754f6e654a1fda2b455c
|
[
"MIT"
] | null | null | null |
defmodule Filex do
@moduledoc """
Filex is a library that wraps file.io's API in an Elixir module. Allows
uploading files with configurable expiration time (days, weeks, months, years).
Functions available in `Filex`:
- `Filex.upload/1`
- `Filex.upload/3`
"""
@doc """
Takes `file_path`, `amount` and `period` as arguments and uploads the file
via file.io's API.
Returns a one-time link to the uploaded file and expiry time.
## Examples
Filex.upload("test/fixtures/image.png", 2, :month)
{ :ok, [url: "https://file.io/aQbnDJ", expires: "60 days"]}
Filex.upload("nonexistent.png")
{ :error, "File not found" }
"""
def upload(file_path, amount, period) do
Filex.TimeMapper.map(amount, period)
|> Filex.Uploader.upload(file_path)
|> Filex.Response.parse()
end
@doc """
Helper function for `Filex.upload/3`, defaulting `amount` and `period`
to 1 week (7 days).
## Examples
Filex.upload("test/fixtures/image.png")
{ :ok, [url: "https://file.io/aQbnDJ", expires: "7 days"]}
"""
def upload(file_path) do
file_path
|> Filex.Uploader.upload()
|> Filex.Response.parse()
end
end
| 24.645833
| 81
| 0.64497
|
93b39db30dc3684004ef7218b160f5480c6176de
| 1,629
|
exs
|
Elixir
|
test/exmqtt/request_response_test.exs
|
kcurtin/exmqtt
|
3431b560117e73c769d30d06b3feada170c3973f
|
[
"Apache-2.0"
] | 13
|
2020-04-12T13:24:32.000Z
|
2021-08-17T00:25:09.000Z
|
test/exmqtt/request_response_test.exs
|
kcurtin/exmqtt
|
3431b560117e73c769d30d06b3feada170c3973f
|
[
"Apache-2.0"
] | null | null | null |
test/exmqtt/request_response_test.exs
|
kcurtin/exmqtt
|
3431b560117e73c769d30d06b3feada170c3973f
|
[
"Apache-2.0"
] | 2
|
2020-05-14T12:43:48.000Z
|
2021-03-02T17:36:24.000Z
|
defmodule Exmqtt.RequestResponseTest do
use ExUnit.Case
require ExmqttConstants
alias ExmqttConstants, as: Const
alias Exmqtt.Support.RequestSender
alias Exmqtt.Support.RequestHandler
@moduletag capture_log: true
test "request response" do
request_response_per_qos(Const.qos_0)
request_response_per_qos(Const.qos_1)
request_response_per_qos(Const.qos_2)
end
def request_response_per_qos(qos) do
req_topic = <<"request_topic">>
rsp_topic = <<"response_topic">>
{:ok, requester} = RequestSender.start_link(rsp_topic, qos,
[{:proto_ver, :v5},
{:clientid, <<"requester">>},
{:properties, %{"Request-Response-Information" => 1}}])
# This is a square service
square = fn(_corr_data, req_bin) ->
i = b2i(req_bin)
i2b(i * i)
end
{:ok, responser} = RequestHandler.start_link(req_topic, qos, square,
[{:proto_ver, :v5},
{:clientid, <<"responser">>}])
:ok = RequestSender.send(requester, req_topic, rsp_topic, <<"corr-1">>, <<"2">>, qos)
receive do
{:response, <<"corr-1">>, <<"4">>} ->
:ok
other ->
:erlang.error({:unexpected, other})
after
100 ->
:erlang.error(:timeout)
end
:ok = RequestSender.stop(requester)
:ok = RequestHandler.stop(responser)
end
def b2i(b), do: :erlang.binary_to_integer(b)
def i2b(i), do: :erlang.integer_to_binary(i)
end
| 31.326923
| 103
| 0.560467
|
93b3a7d3fa94ce18047850e0cb57ff0e73688d10
| 1,387
|
exs
|
Elixir
|
test/pix_chargeback_log_test.exs
|
starkinfra/sdk-elixir
|
d434de336ad7d2331b860519f04e9d107bb9c9cd
|
[
"MIT"
] | 1
|
2022-03-15T18:58:21.000Z
|
2022-03-15T18:58:21.000Z
|
test/pix_chargeback_log_test.exs
|
starkinfra/sdk-elixir
|
d434de336ad7d2331b860519f04e9d107bb9c9cd
|
[
"MIT"
] | null | null | null |
test/pix_chargeback_log_test.exs
|
starkinfra/sdk-elixir
|
d434de336ad7d2331b860519f04e9d107bb9c9cd
|
[
"MIT"
] | null | null | null |
defmodule StarkInfraTest.PixChargeback.Log do
use ExUnit.Case
@tag :pix_chargeback_log
test "get pix chargeback log" do
log =
StarkInfra.PixChargeback.Log.query!(limit: 1)
|> Enum.take(1)
|> hd()
{:ok, unique_log} = StarkInfra.PixChargeback.Log.get(log.id)
assert unique_log.id == log.id
end
@tag :pix_chargeback_log
test "get! pix chargeback log" do
log =
StarkInfra.PixChargeback.Log.query!(limit: 1)
|> Enum.take(1)
|> hd()
unique_log = StarkInfra.PixChargeback.Log.get!(log.id)
assert unique_log.id == log.id
end
@tag :pix_chargeback_log
test "query pix chargeback log" do
StarkInfra.PixChargeback.Log.query(limit: 101)
|> Enum.take(200)
|> (fn list -> assert length(list) <= 101 end).()
end
@tag :pix_chargeback_log
test "query! pix chargeback log" do
StarkInfra.PixChargeback.Log.query!(limit: 101)
|> Enum.take(200)
|> (fn list -> assert length(list) <= 101 end).()
end
@tag :pix_chargeback_log
test "page pix chargeback log" do
{:ok, ids} = StarkInfraTest.Utils.Page.get(&StarkInfra.PixChargeback.Log.page/1, 2, limit: 5)
assert length(ids) <= 10
end
@tag :pix_chargeback_log
test "page! pix chargeback log" do
ids = StarkInfraTest.Utils.Page.get!(&StarkInfra.PixChargeback.Log.page!/1, 2, limit: 5)
assert length(ids) <= 10
end
end
| 26.673077
| 97
| 0.664023
|
93b3c98c097b929098da091ae882ab57e2c63171
| 1,817
|
ex
|
Elixir
|
lib/redix/uri.ex
|
SoCal-Software-Labs/safe-redix
|
6ac3d42c104ee3a2bcd5d726aaca1474e95cc29f
|
[
"MIT"
] | 968
|
2015-08-17T14:14:57.000Z
|
2022-03-29T03:39:17.000Z
|
lib/redix/uri.ex
|
SoCal-Software-Labs/safe-redix
|
6ac3d42c104ee3a2bcd5d726aaca1474e95cc29f
|
[
"MIT"
] | 192
|
2015-08-17T20:39:57.000Z
|
2022-03-23T08:48:36.000Z
|
lib/redix/uri.ex
|
SoCal-Software-Labs/safe-redix
|
6ac3d42c104ee3a2bcd5d726aaca1474e95cc29f
|
[
"MIT"
] | 145
|
2015-08-17T20:38:22.000Z
|
2022-03-04T22:59:47.000Z
|
defmodule Redix.URI do
@moduledoc false
@spec opts_from_uri(binary) :: Keyword.t()
def opts_from_uri(uri) when is_binary(uri) do
%URI{host: host, port: port, scheme: scheme} = uri = URI.parse(uri)
unless scheme in ["redis", "rediss"] do
raise ArgumentError, "expected scheme to be redis:// or rediss://, got: #{scheme}://"
end
{username, password} = username_and_password(uri)
[]
|> put_if_not_nil(:host, host)
|> put_if_not_nil(:port, port)
|> put_if_not_nil(:username, username)
|> put_if_not_nil(:password, password)
|> put_if_not_nil(:database, database(uri))
|> enable_ssl_if_secure_scheme(scheme)
end
defp username_and_password(%URI{userinfo: nil}) do
{nil, nil}
end
defp username_and_password(%URI{userinfo: userinfo}) do
case String.split(userinfo, ":", parts: 2) do
["", password] ->
{nil, password}
[username, password] ->
{username, password}
_other ->
raise ArgumentError,
"expected password in the Redis URI to be given as redis://:PASSWORD@HOST or " <>
"redis://USERNAME:PASSWORD@HOST"
end
end
defp database(%URI{path: path}) when path in [nil, "", "/"] do
nil
end
defp database(%URI{path: "/" <> path = full_path}) do
case Integer.parse(path) do
{db, rest} when rest == "" or binary_part(rest, 0, 1) == "/" ->
db
_other ->
raise ArgumentError, "expected database to be an integer, got: #{inspect(full_path)}"
end
end
defp put_if_not_nil(opts, _key, nil), do: opts
defp put_if_not_nil(opts, key, value), do: Keyword.put(opts, key, value)
defp enable_ssl_if_secure_scheme(opts, "rediss"), do: Keyword.put(opts, :ssl, true)
defp enable_ssl_if_secure_scheme(opts, _scheme), do: opts
end
| 29.306452
| 95
| 0.636214
|
93b3dfb22e20380fb24b03ea79c811445c3febc5
| 287
|
ex
|
Elixir
|
books/seven_concurrencies_in_7_weeks/actors/patterns/patterns.ex
|
JiniousChoi/encyclopedia-in-code
|
77bc551a03a2a3e3808e50016ece14adb5cfbd96
|
[
"MIT"
] | 2
|
2018-07-20T10:15:49.000Z
|
2018-07-20T10:16:54.000Z
|
books/seven_concurrencies_in_7_weeks/actors/patterns/patterns.ex
|
JiniousChoi/encyclopedia-in-code
|
77bc551a03a2a3e3808e50016ece14adb5cfbd96
|
[
"MIT"
] | 2
|
2018-06-26T09:12:44.000Z
|
2019-12-18T00:09:14.000Z
|
books/seven_concurrencies_in_7_weeks/actors/patterns/patterns.ex
|
JiniousChoi/encyclopedia-in-code
|
77bc551a03a2a3e3808e50016ece14adb5cfbd96
|
[
"MIT"
] | null | null | null |
# START:patterns
defmodule Patterns do
def foo({x, y}) do
IO.puts("Got a pair, first element #{x}, second #{y}")
end
# END:patterns
# START:patterns2
def foo({x, y, z}) do
IO.puts("Got a triple: #{x}, #{y}, #{z}")
end
# END:patterns2
# START:patterns
end
# END:patterns
| 17.9375
| 58
| 0.61324
|
93b3ecea82864ade3d55daac912abba54b6d7489
| 26,937
|
ex
|
Elixir
|
lib/phoenix_live_view.ex
|
hykw/phoenix_live_view
|
da34e4886885f1f0f0dd7692b72663e4e94d9c98
|
[
"MIT"
] | null | null | null |
lib/phoenix_live_view.ex
|
hykw/phoenix_live_view
|
da34e4886885f1f0f0dd7692b72663e4e94d9c98
|
[
"MIT"
] | null | null | null |
lib/phoenix_live_view.ex
|
hykw/phoenix_live_view
|
da34e4886885f1f0f0dd7692b72663e4e94d9c98
|
[
"MIT"
] | null | null | null |
defmodule Phoenix.LiveView do
@moduledoc """
LiveView provides rich, real-time user experiences with
server-rendered HTML.
LiveView programming model is declarative: instead of
saying "once event X happens, change Y on the page",
events in LiveView are regular messages which may cause
changes to its state. Once the state changes, LiveView will
re-render the relevant parts of its HTML template and push it
to the browser, which updates itself in the most efficient
manner. This means developers write LiveView templates as
any other server-rendered HTML and LiveView does the hard
work of tracking changes and sending the relevant diffs to
the browser.
At the end of the day, a LiveView is nothing more than a
process, that receives events as messages and updates its
state. The state itself is nothing more than functional
and immutable Elixir data structures. The events are either
internal application messages (usually emitted by `Phoenix.PubSub`)
or sent by the client/browser.
LiveView provides many features that make it excellent
to build rich, real-time user experiences:
* By building on top of Elixir processes and
`Phoenix.Channels`, LiveView scales well vertically
(from small to large instances) and horizontally
(by adding more instances);
* LiveView is first rendered statically as part of
regular HTTP requests, which provides quick times
for "First Meaningful Paint" and also help search
and indexing engines;
* LiveView performs diff tracking. If the LiveView
state changes, it won't re-render the whole template,
but only the parts affected by the changed state.
This reduces latency and the amount of data sent over
the wire;
* LiveView tracks static and dynamic contents. Any
server-rendered HTML is made of static parts (i.e.
that never change) and dynamic ones. On the first
render, LiveView sends the static contents and in
future updates only the modified dynamic contents
are resent;
* (Coming soon) LiveView uses the Erlang Term Format
to send messages to the client. This binary-based
format is quite efficient on the server and uses
less data over the wire;
* (Coming soon) LiveView includes a latency simulator,
which allows you to simulate how your application
behaves on increased latency and guides you to provide
meaningful feedback to users while they wait for events
to be processed;
Furthermore, by keeping a persistent connection between client
and server, LiveView applications can react faster to user events
as there is less work to be done and less data to be sent compared
to stateless requests that have to authenticate, decode, load,
and encode data on every request. The flipside is that LiveView
uses more memory on the server compared to stateless requests.
## Use cases
There are many use cases where LiveView is an excellent
fit right now:
* Handling of user interaction and inputs, buttons, and
forms - such as input validation, dynamic forms,
autocomplete, etc;
* Events and updates pushed by server - such as
notifications, dashboards, etc;
There are other cases that have limited support but
will become first-class as we further develop LiveView:
* Page and data navigation - such as navigating between
pages, pagination, etc can be built with LiveView
but currently you will lose the back/forward button,
and the ability to link to pages as you navigate.
Support for `pushState` is on the roadmap;
* Cumulative and always growing data - chat
applications, logs, and similar can be built with
LiveView but currently you have to keep in the
server a copy of all messages shown in the client
as there is no append/prepend operation. Support
for append/prepend is on the roadmap;
* Transitions and loading states - the LiveView
programming model provides a good foundation for
transitions and loading states since any UI change
done after a user action is undone once the server
sends the update for said action. For example, it is
relatively straight-forward to click a button that
changes itself in a way that is automatically undone
when the update arrives. This is especially important
as user feedback when latency is involved. A complete
feature set for modelling those states is coming in
future versions;
There are also use cases which are a bad fit for LiveView:
* Animations - animations, menus, and general events
that do not need the server in the first place are a
bad fit for LiveView, as they can be achieved purely
with CSS and/or CSS transitions;
* Optimistic UIs - once we add transitions and loading
states, many of the building blocks necessary for
building optimistic UIs will be part of LiveView, but
since optimistic UIs are about doing work on the client
while the server is unavailable, complete support for
Optimistic UIs cannot be achieved without also writing
JavaScript for the cases the server is not available;
## Life-cycle
A LiveView begins as a regular HTTP request and HTML response,
and then upgrades to a stateful view on client connect,
guaranteeing a regular HTML page even if JavaScript is disabled.
Any time a stateful view changes or updates its socket assigns, it is
automatically re-rendered and the updates are pushed to the client.
You begin by rendering a LiveView from your router or controller
while providing *session* data to the view, which represents request info
necessary for the view, such as params, cookie session info, etc.
The session is signed and stored on the client, then provided back
to the server when the client connects, or reconnects to the stateful
view. When a view is rendered from the controller, the `mount/2` callback
is invoked with the provided session data and the LiveView socket.
The `mount/2` callback wires up socket assigns necessary for rendering
the view. After mounting, `render/1` is invoked and the HTML is sent
as a regular HTML response to the client.
After rendering the static page with a signed session, LiveView
connects from the client where stateful views are spawned
to push rendered updates to the browser, and receive client events
via phx bindings. Just like the controller flow, `mount/2` is invoked
with the signed session, and socket state, where mount assigns
values for rendering. However, in the connected client case, a
LiveView process is spawned on the server, pushes the result of
`render/1` to the client and continues on for the duration of the
connection. If at any point during the stateful life-cycle a
crash is encountered, or the client connection drops, the client
gracefully reconnects to the server, passing its signed session
back to `mount/2`.
## Example
First, a LiveView requires two callbacks: `mount/2` and `render/1`:
defmodule AppWeb.ThermostatLive do
use Phoenix.LiveView
def render(assigns) do
~L\"""
Current temperature: <%= @temperature %>
\"""
end
def mount(%{id: id, current_user_id: user_id}, socket) do
case Thermostat.get_user_reading(user_id, id) do
{:ok, temperature} ->
{:ok, assign(socket, :temperature, temperature)}
{:error, reason} ->
{:error, reason}
end
end
end
The `render/1` callback receives the `socket.assigns` and is responsible
for returning rendered content. You can use `Phoenix.LiveView.sigil_L/2`
to inline LiveView templates. If you want to use `Phoenix.HTML` helpers,
remember to `use Phoenix.HTML` at the top of your `LiveView`.
A separate `.leex` HTML template can also be rendered within
your `render/1` callback by delegating to an existing `Phoenix.View`
module in your application. For example:
defmodule AppWeb.ThermostatLive do
use Phoenix.LiveView
def render(assigns) do
AppWeb.PageView.render("page.html", assigns)
end
end
With a LiveView defined, you first define the `socket` path in your endpoint,
and point it to `Phoenix.LiveView.Socket`:
defmodule AppWeb.Endpoint do
use Phoenix.Endpoint
socket "/live", Phoenix.LiveView.Socket
...
end
And configure its signing salt in the endpoint:
config :my_app, AppWeb.Endpoint,
...,
live_view: [signing_salt: ...]
You can generate a secure, random signing salt with the
`mix phx.gen.secret 32` task.
Next, you can serve the LiveView directly from your router:
defmodule AppWeb.Router do
use Phoenix.Router
import Phoenix.LiveView.Router
scope "/", AppWeb do
live "/thermostat", ThermostatLive
end
end
Or you can `live_render` your view from any controller:
defmodule AppWeb.ThermostatController do
...
import Phoenix.LiveView.Controller
def show(conn, %{"id" => id}) do
live_render(conn, AppWeb.ThermostatLive, session: %{
id: id,
current_user_id: get_session(conn, :user_id),
})
end
end
As we saw in the life-cycle section, you pass `:session` data about the
request to the view, such as the current user's id in the cookie session,
and parameters from the request. A regular HTML response is sent with a
signed token embedded in the DOM containing your LiveView session data.
Next, your client code connects to the server:
import LiveSocket from "phoenix_live_view"
let liveSocket = new LiveSocket("/live")
liveSocket.connect()
After the client connects, `mount/2` will be invoked inside a spawned
LiveView process. At this point, you can use `connected?/1` to
conditionally perform stateful work, such as subscribing to pubsub topics,
sending messages, etc. For example, you can periodically update a LiveView
with a timer:
defmodule DemoWeb.ThermostatLive do
use Phoenix.LiveView
...
def mount(%{id: id, current_user_id: user_id}, socket) do
if connected?(socket), do: :timer.send_interval(30000, self(), :update)
case Thermostat.get_user_reading(user_id, id) do
{:ok, temperature} ->
{:ok, assign(socket, temperature: temperature, id: id)}
{:error, reason} ->
{:error, reason}
end
end
def handle_info(:update, socket) do
{:ok, temperature} = Thermostat.get_reading(socket.assigns.id)
{:noreply, assign(socket, :temperature, temperature)}
end
end
We used `connected?(socket)` on mount to send our view a message every 30s if
the socket is in a connected state. We receive `:update` in a
`handle_info` just like a GenServer, and update our socket assigns. Whenever
a socket's assigns change, `render/1` is automatically invoked, and the
updates are sent to the client.
## LiveEEx Templates
`Phoenix.LiveView`'s built-in templates provided by the `.leex`
extension or `~L` sigil, stands for Live EEx. They are similar
to regular `.eex` templates except they are designed to minimize
the amount of data sent over the wire by splitting static from
dynamic parts and also tracking changes.
When you first render a `.leex` template, it will send all of the
static and dynamic parts of the template to the client. After that,
any change you do on the server will now send only the dynamic parts,
and only if those parts have changed.
The tracking of changes is done via assigns. Imagine this template:
<div id="user_<%= @user.id %>">
<%= @user.name %>
</div>
If the `@user` assign changes, then LiveView will re-render only
the `@user.id` and `@user.name` and sent it to the browser. That's
why it is important to keep most of the markup in the template itself.
If you write the div above to something like:
<%= username_div(@user) %>
Then if the `@user` changes, the whole div will be sent (but only
if the `@user` assign changes).
The assign tracking feature also implies that you MUST pass all of
the data to your templates explicitly and avoid performing direct
operations on the template as much as possible. For example, if you
perform this operation in your template:
<%= for user <- Repo.all(User) do %>
<%= user.name %>
<% end %>
Then Phoenix will never re-render the section above, even if the amount of
users in the database changes. Instead, you need to store the users as
assigns in your LiveView before it renders the template:
assign(socket, :users, Repo.all(User))
Generally speaking, **data loading should never happen inside the template**,
regardless if you are using LiveView or not. The difference is that LiveView
enforces those as best practices.
## Bindings
Phoenix supports DOM element bindings for client-server interaction. For
example, to react to a click on a button, you would render the element:
<button phx-click="inc_temperature">+</button>
Then on the server, all LiveView bindings are handled with the `handle_event`
callback, for example:
def handle_event("inc_temperature", _value, socket) do
{:ok, new_temp} = Thermostat.inc_temperature(socket.assigns.id)
{:noreply, assign(socket, :temperature, new_temp)}
end
### Click Events
The `phx-click` binding is used to send click events to the server. The
`value` passed to `handle_event` is chosen on the client with the following
priority:
* An optional `"phx-value"` binding on the clicked element
* The clicked element's `value` property
* An empty string
### Focus and Blur Events
Focus and blur events may be bound to DOM elements that emit
such events, using the `phx-blur`, and `phx-focus` bindings, for example:
<input name="email" phx-focus="myfocus" phx-blur="myblur"/>
To detect when the page itself has receive focus or blur,
`phx-target` may be specified as `"window"`. Like other
bindings, a `phx-value` can be provided on the bound element,
otherwise the input's value will be used. For example:
<div class="container"
phx-focus="page-active"
phx-blur="page-inactive"
phx-target="window">
...
</div>
### Form Events
To handle form changes and submissions, use the `phx-change` and `phx-submit`
events. In general, it is preferred to handle input changes at the form level,
where all form fields are passed to the LiveView's callback given any
single input change. For example, to handle real-time form validation and
saving, your template would use both `phx_change` and `phx_submit` bindings:
<%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save], fn f -> %>
<%= label f, :username %>
<%= text_input f, :username %>
<%= error_tag f, :username %>
<%= label f, :email %>
<%= text_input f, :email %>
<%= error_tag f, :email %>
<%= submit "Save" %>
<% end %>
Next, your LiveView picks up the events in `handle_event` callbacks:
def render(assigns) ...
def mount(_session, socket) do
{:ok, assign(socket, %{changeset: Accounts.change_user(%User{})})}
end
def handle_event("validate", %{"user" => params}, socket) do
changeset =
%User{}
|> Accounts.change_user(params)
|> Map.put(:action, :insert)
{:noreply, assign(socket, changeset: changeset)}
end
def handle_event("save", %{"user" => user_params}, socket) do
case Accounts.create_user(user_params) do
{:ok, user} ->
{:stop,
socket
|> put_flash(:info, "user created")
|> redirect(to: Routes.user_path(AppWeb.Endpoint, AppWeb.User.ShowView, user))}
{:error, %Ecto.Changeset{} = changeset} ->
{:noreply, assign(socket, changeset: changeset)}
end
end
The validate callback simply updates the changeset based on all form input
values, then assigns the new changeset to the socket. If the changeset
changes, such as generating new errors, `render/1` is invoked and
the form is re-rendered.
Likewise for `phx-submit` bindings, the save callback is invoked and
persistence is attempted. On success, a `:stop` tuple is returned and the
socket is annotated for redirect with `Phoenix.LiveView.redirect/2`,
otherwise the socket assigns are updated with the errored changeset to be
re-rerendered for the client.
*Note*: For proper form error tag updates, the error tag must specify which
input it belongs to. This is accomplished with the `data-phx-error-for` attribute.
For example, your `AppWeb.ErrorHelpers` may use this function:
def error_tag(form, field) do
Enum.map(Keyword.get_values(form.errors, field), fn error ->
content_tag(:span, translate_error(error),
class: "help-block",
data: [phx_error_for: input_id(form, field)]
)
end)
end
### Key Events
The onkeydown, and onkeyup events are supported via
the `phx-keydown`, and `phx-keyup` bindings. When
pushed, the value sent to the server will be the event's `key`.
By default, the bound element will be the event listener, but an
optional `phx-target` may be provided which may be `"document"`,
`"window"`, or the DOM id of a target element, for example:
@up_key 38
@down_key 40
def render(assigns) do
~L\"""
<div id="thermostat" phx-keyup="update_temp" phx-target="document">
Current temperature: <%= @temperature %>
</div>
\"""
end
def handle_event("update_temp", @up_key, socket) do
{:ok, new_temp} = Thermostat.inc_temperature(socket.assigns.id)
{:noreply, assign(socket, :temperature, new_temp)}
end
def handle_event("update_temp", @down_key, socket) do
{:ok, new_temp} = Thermostat.dec_temperature(socket.assigns.id)
{:noreply, assign(socket, :temperature, new_temp)}
end
def handle_event("update_temp", _key, socket) do
{:noreply, socket}
end
"""
alias Phoenix.LiveView
alias Phoenix.LiveView.Socket
@type unsigned_params :: map
@type from :: binary
@callback mount(session :: map, Socket.t()) ::
{:ok, Socket.t()} | {:stop, Socket.t()}
@callback render(Socket.assigns()) :: Phoenix.LiveView.Rendered.t()
@callback terminate(reason, Socket.t()) :: term
when reason: :normal | :shutdown | {:shutdown, :left | :closed | term}
@callback handle_event(event :: binary, unsigned_params, Socket.t()) ::
{:noreply, Socket.t()} | {:stop, Socket.t()}
@callback handle_call(msg :: term, {pid, reference}, Socket.t()) ::
{:noreply, Socket.t()} | {:reply, term, Socket.t()} | {:stop, Socket.t()}
@callback handle_info(msg :: term, Socket.t()) ::
{:noreply, Socket.t()} | {:reply, term, Socket.t()} | {:stop, Socket.t()}
@optional_callbacks terminate: 2, handle_event: 3, handle_call: 3, handle_info: 2
defmacro __using__(_opts) do
quote do
import unquote(__MODULE__)
@behaviour unquote(__MODULE__)
@impl unquote(__MODULE__)
def mount(_session, socket), do: {:ok, socket}
defoverridable mount: 2
end
end
@doc """
Renders a LiveView within an originating plug request or
within a parent LiveView.
## Options
* `:session` - the map of session data to sign and send
to the client. When connecting from the client, the LiveView
will receive the signed session from the client and verify
the contents before proceeding with `mount/2`.
* `:container` - the optional tuple for the HTML tag and DOM attributes to
be used for the LiveView container. For example: `{:li, style: "color: blue;"}`
* `:child_id` - the ID to uniquely identify a child LiveView when
live rendering children of the same type.
## Examples
# within eex template
<%= live_render(@conn, MyApp.ThermostatLive) %>
# within leex template
<%= live_render(@socket, MyApp.ThermostatLive) %>
"""
def live_render(conn_or_socket, view, opts \\ []) do
opts = Keyword.put_new(opts, :session, %{})
do_live_render(conn_or_socket, view, opts)
end
defp do_live_render(%Plug.Conn{} = conn, view, opts) do
case LiveView.View.static_render(conn, view, opts) do
{:ok, content} ->
content
{:stop, {:redirect, _opts}} ->
raise RuntimeError, """
attempted to redirect from #{inspect(view)} while rendering Plug request.
Redirects from live renders inside a Plug request are not supported.
"""
end
end
defp do_live_render(%Socket{} = parent, view, opts) do
case LiveView.View.nested_static_render(parent, view, opts) do
{:ok, content} -> content
{:stop, reason} -> throw({:stop, reason})
end
end
@doc """
Returns true if the socket is connected.
Useful for checking the connectivity status when mounting the view.
For example, on initial page render, the view is mounted statically,
rendered, and the HTML is sent to the client. Once the client
connects to the server, a LiveView is then spawned and mounted
statefully within a process. Use `connected?/1` to conditionally
perform stateful work, such as subscribing to pubsub topics,
sending messages, etc.
## Examples
defmodule DemoWeb.ClockLive do
use Phoenix.LiveView
...
def mount(_session, socket) do
if connected?(socket), do: :timer.send_interval(1000, self(), :tick)
{:ok, assign(socket, date: :calendar.local_time())}
end
def handle_info(:tick, socket) do
{:noreply, assign(socket, date: :calendar.local_time())}
end
end
"""
def connected?(%Socket{} = socket) do
LiveView.View.connected?(socket)
end
@doc """
Assigns a value into the socket only if it does not exist.
Useful for lazily assigning values and referencing parent assigns.
## Referencing parent assigns
When a LiveView is mounted in a disconnected state, the Plug.Conn assigns
will be available for reference via `assign_new/3`, allowing assigns to
be shared for the initial HTTP request. On connected mount, the `assign_new/3`
would be invoked, and the LiveView would use its session to rebuild the
originally shared assign. Likewise, nested LiveView children have access
to their parent's assigns on mount using `assign_new`, which allows
assigns to be shared down the nested LiveView tree.
## Examples
# controller
conn
|> assign(:current_user, user)
|> LiveView.Controller.live_render(MyLive, session: %{user_id: user.id})
# LiveView mount
def mount(%{user_id: user_id}, socket) do
{:ok, assign_new(socket, :current_user, fn -> Accounts.get_user!(user_id) end)}
end
"""
def assign_new(%Socket{} = socket, key, func) when is_function(func, 0) do
case socket do
%{assigns: %{^key => _}} ->
socket
%{private: %{assigned_new: {assigns, keys}} = private} ->
# It is important to store the keys even if they are not in assigns
# because maybe the controller doesn't have it but the view does.
private = put_in(private.assigned_new, {assigns, [key | keys]})
do_assign(%{socket | private: private}, key, Map.get_lazy(assigns, key, func))
%{} ->
do_assign(socket, key, func.())
end
end
@doc """
Adds key value pairs to socket assigns.
A single key value pair may be passed, or a keyword list
of assigns may be provided to be merged into existing
socket assigns.
## Examples
iex> assign(socket, :name, "Elixir")
iex> assign(socket, name: "Elixir", logo: "💧")
"""
def assign(%Socket{} = socket, key, value) do
assign(socket, [{key, value}])
end
def assign(%Socket{} = socket, attrs)
when is_map(attrs) or is_list(attrs) do
Enum.reduce(attrs, socket, fn {key, val}, acc ->
case Map.fetch(acc.assigns, key) do
{:ok, ^val} -> acc
{:ok, _old_val} -> do_assign(acc, key, val)
:error -> do_assign(acc, key, val)
end
end)
end
defp do_assign(%Socket{assigns: assigns, changed: changed} = acc, key, val) do
new_changed = Map.put(changed, key, true)
new_assigns = Map.put(assigns, key, val)
%Socket{acc | assigns: new_assigns, changed: new_changed}
end
@doc """
Updates an existing key in the socket assigns.
The update function receives the current key's value and
returns the updated value. Raises if the key does not exist.
## Examples
iex> update(socket, :count, fn count -> count + 1 end)
iex> update(socket, :count, &(&1 + 1))
"""
def update(%Socket{assigns: assigns} = socket, key, func) do
case Map.fetch(assigns, key) do
{:ok, val} -> assign(socket, key, func.(val))
:error -> raise KeyError, key: key, term: assigns
end
end
@doc """
Adds a flash message to the socket to be displayed on redirect.
*Note*: the `Phoenix.LiveView.Flash` plug must be plugged in
your browser's pipeline for flash to be supported, for example:
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug Phoenix.LiveView.Flash
...
end
## Examples
iex> put_flash(socket, :info, "It worked!")
iex> put_flash(socket, :error, "You can't access that page")
"""
def put_flash(%Socket{private: private} = socket, kind, msg) do
new_private = Map.update(private, :flash, %{kind => msg}, &Map.put(&1, kind, msg))
%Socket{socket | private: new_private}
end
@doc """
Annotates the socket for redirect to a destination path.
*Note*: LiveView redirects rely on instructing client
to perform a `window.location` update on the provided
redirect location.
TODO support `:external` and validation `:to` is a local path
## Options
* `:to` - the path to redirect to
"""
def redirect(%Socket{} = socket, opts) do
LiveView.View.put_redirect(socket, Keyword.fetch!(opts, :to))
end
@doc """
Provides `~L` sigil with HTML safe Live EEx syntax inside source files.
iex> ~L"\""
...> Hello <%= "world" %>
...> "\""
{:safe, ["Hello ", "world", "\\n"]}
"""
defmacro sigil_L({:<<>>, _, [expr]}, []) do
EEx.compile_string(expr, engine: Phoenix.LiveView.Engine, line: __CALLER__.line + 1)
end
end
| 35.772908
| 92
| 0.676987
|
93b4443416d68fc653b2ac29f3069dfa6dc13014
| 2,942
|
ex
|
Elixir
|
apps/mc/lib/mc.ex
|
savonarola/smppex_graceful
|
dd8b5e2d26f2f4f11b357327a304ef39b188da70
|
[
"MIT"
] | null | null | null |
apps/mc/lib/mc.ex
|
savonarola/smppex_graceful
|
dd8b5e2d26f2f4f11b357327a304ef39b188da70
|
[
"MIT"
] | null | null | null |
apps/mc/lib/mc.ex
|
savonarola/smppex_graceful
|
dd8b5e2d26f2f4f11b357327a304ef39b188da70
|
[
"MIT"
] | 2
|
2020-08-06T20:25:30.000Z
|
2021-02-01T13:22:41.000Z
|
defmodule MC do
use SMPPEX.Session
alias SMPPEX.Pdu
alias SMPPEX.Pdu.Factory, as: PduFactory
alias SMPPEX.Pdu.Errors
alias __MODULE__, as: MC
@system_id "MC"
defstruct [
state: :unbound,
last_msg_id: 1
]
def start(port) do
SMPPEX.MC.start({MC, []}, transport_opts: [port: port])
end
def init(_socket, _transport, []) do
Logger.metadata(role: :mc)
Logger.info("Peer connected")
{:ok, %MC{}}
end
def handle_pdu(pdu, st) do
case Pdu.command_name(pdu) do
:bind_transmitter -> handle_bind(pdu, st)
:bind_receiver -> handle_bind(pdu, st)
:bind_transceiver -> handle_bind(pdu, st)
:submit_sm -> handle_submit_sm(pdu, st)
:unbind -> handle_unbind(pdu, st)
_ -> {:ok, st}
end
end
def handle_socket_closed(st) do
if st.state == :terminating do
Logger.info("Peer correctly teminated connection")
{:normal, st}
else
Logger.warn("Peer teminated connection abnormally")
{:normal, st}
end
end
def terminate(reason, _lost_pdus, _st) do
Logger.info("Terminating with reason #{inspect reason}")
:stop
end
# Private
defp handle_bind(pdu, st) do
case st.state do
:unbound ->
Logger.metadata(system_id: Pdu.mandatory_field(pdu, :system_id))
{:ok, [bind_resp(pdu, :ROK)], %MC{st | state: :bound}}
:bound ->
{:ok, [bind_resp(pdu, :RALYBND)], st}
:terminating ->
{:ok, [bind_resp(pdu, :RALYBND)], st}
end
end
defp bind_resp(pdu, command_status) do
PduFactory.bind_resp(
bind_resp_command_id(pdu),
Errors.code_by_name(command_status),
@system_id
) |> Pdu.as_reply_to(pdu)
end
defp bind_resp_command_id(pdu), do: 0x80000000 + Pdu.command_id(pdu)
defp handle_submit_sm(pdu, st) do
case st.state do
:unbound ->
{:ok, [submit_sm_error_resp(pdu, :RINVBNDSTS)], st}
:bound ->
{resp, new_st} = submit_sm_ok_resp(pdu, st)
{:ok, [resp], new_st}
:terminating ->
{:ok, [submit_sm_error_resp(pdu, :RINVBNDSTS)], st}
end
end
defp submit_sm_error_resp(pdu, status) do
status
|> Errors.code_by_name
|> PduFactory.submit_sm_resp
|> Pdu.as_reply_to(pdu)
end
defp submit_sm_ok_resp(pdu, st) do
msg_id = st.last_msg_id + 1
resp = :ROK
|> Errors.code_by_name
|> PduFactory.submit_sm_resp(to_string(msg_id))
|> Pdu.as_reply_to(pdu)
{resp, %MC{st | last_msg_id: msg_id}}
end
defp handle_unbind(pdu, st) do
case st.state do
:unbound ->
{:ok, [unbind_resp(pdu, :RINVBNDSTS)], st}
:bound ->
{:ok, [unbind_resp(pdu, :ROK)], %MC{st | state: :terminating}}
:terminating ->
{:ok, [unbind_resp(pdu, :RINVBNDSTS)], st}
end
end
defp unbind_resp(pdu, status) do
code = Errors.code_by_name(status)
PduFactory.unbind_resp(code) |> Pdu.as_reply_to(pdu)
end
end
| 23.536
| 72
| 0.624065
|
93b45164f467370f3c69a77102868e38b92ae9ca
| 271
|
ex
|
Elixir
|
lib/rfx/util/str.ex
|
doorgan/rfx
|
566b8623ce8957632329b4b0a142ea26a46f2301
|
[
"MIT"
] | null | null | null |
lib/rfx/util/str.ex
|
doorgan/rfx
|
566b8623ce8957632329b4b0a142ea26a46f2301
|
[
"MIT"
] | null | null | null |
lib/rfx/util/str.ex
|
doorgan/rfx
|
566b8623ce8957632329b4b0a142ea26a46f2301
|
[
"MIT"
] | null | null | null |
defmodule Rfx.Util.Str do
def rand_str(length \\ 4) do
Stream.repeatedly(&rchar/0) |> Enum.take(length) |> Enum.join()
end
defp rchar do
?a..?z |>
Enum.to_list() |>
to_string() |>
String.split("", trim: true) |>
Enum.random()
end
end
| 16.9375
| 67
| 0.575646
|
93b46b5c219855029ef67a95fdcd7ee9412d11bc
| 2,560
|
exs
|
Elixir
|
test/straw_hat_map/states_test.exs
|
straw-hat-team/straw_hat_map
|
df71340122852577b9df2ed2afcbcc4be879aba1
|
[
"MIT"
] | 4
|
2018-03-07T04:12:36.000Z
|
2018-03-08T16:13:14.000Z
|
test/straw_hat_map/states_test.exs
|
straw-hat-labs/straw_hat_map
|
df71340122852577b9df2ed2afcbcc4be879aba1
|
[
"MIT"
] | 61
|
2018-03-07T04:50:42.000Z
|
2019-11-01T10:24:03.000Z
|
test/straw_hat_map/states_test.exs
|
straw-hat-team/straw_hat_map
|
df71340122852577b9df2ed2afcbcc4be879aba1
|
[
"MIT"
] | 2
|
2018-03-22T19:44:45.000Z
|
2019-08-02T03:45:47.000Z
|
defmodule StrawHat.Map.StatesTests do
use StrawHat.Map.TestSupport.CaseTemplate, async: true
alias StrawHat.Map.States
describe "finding a state" do
test "with a valid ID" do
state = insert(:state)
assert {:ok, _state} = States.find_state(Repo, state.id)
end
test "with an invalid ID" do
state_id = Ecto.UUID.generate()
assert {:error, _reason} = States.find_state(Repo, state_id)
end
end
test "returning a pagination of states" do
insert_list(6, :state)
state_page = States.get_states(Repo, %{page: 2, page_size: 5})
assert length(state_page.entries) == 1
end
test "creating a state with valid inputs" do
country = insert(:country)
params = params_for(:state, %{country_id: country.id})
assert {:ok, _state} = States.create_state(Repo, params)
assert {:error, _state} = States.create_state(Repo, params)
end
test "updating a state with valid inputs" do
state = insert(:state)
{:ok, state} = States.update_state(Repo, state, %{name: "Havana"})
assert state.name == "Havana"
end
test "destroying an existing state" do
state = insert(:state)
assert {:ok, _} = States.destroy_state(Repo, state)
end
test "getting a list of states with a list of state's IDs" do
states_ids =
3
|> insert_list(:state)
|> Enum.map(&Map.get(&1, :id))
found_states_ids =
Repo
|> States.get_states_by_ids(states_ids)
|> Enum.map(&Map.get(&1, :id))
assert states_ids == found_states_ids
end
test "getting a list of cities of a state" do
state = insert(:state)
cities_ids =
3
|> insert_list(:city, %{state: state})
|> Enum.map(&Map.get(&1, :id))
found_cities_ids =
Repo
|> States.get_cities(state)
|> Enum.map(&Map.get(&1, :id))
assert cities_ids == found_cities_ids
end
test "getting a list of cities with a list of state's IDs" do
[first_state, second_state] = insert_list(2, :state)
insert_list(2, :city, %{state: first_state})
insert_list(2, :city, %{state: second_state})
cities = States.get_cities(Repo, [first_state.id, second_state.id])
assert length(cities) == 4
end
test "getting a list of counties with a list of state's IDs" do
[first_state, second_state] = insert_list(2, :state)
insert_list(2, :county, %{state: first_state})
insert_list(2, :county, %{state: second_state})
counties = States.get_counties(Repo, [first_state.id, second_state.id])
assert length(counties) == 4
end
end
| 26.947368
| 75
| 0.653516
|
93b479772da2702470deca6b5cde8578409c9f4c
| 61
|
ex
|
Elixir
|
apps/robby_web/web/views/user_view.ex
|
jeffweiss/openrobby
|
9fed2024e6ce87a6fe27ef3af85558f3116aca2a
|
[
"Apache-2.0"
] | 3
|
2021-04-16T21:54:55.000Z
|
2021-04-30T22:15:41.000Z
|
apps/robby_web/web/views/user_view.ex
|
jeffweiss/openrobby
|
9fed2024e6ce87a6fe27ef3af85558f3116aca2a
|
[
"Apache-2.0"
] | 1
|
2021-06-29T15:54:19.000Z
|
2021-06-29T15:54:19.000Z
|
apps/robby_web/web/views/user_view.ex
|
jeffweiss/openrobby
|
9fed2024e6ce87a6fe27ef3af85558f3116aca2a
|
[
"Apache-2.0"
] | 2
|
2021-04-16T22:23:16.000Z
|
2021-05-26T15:52:55.000Z
|
defmodule RobbyWeb.UserView do
use RobbyWeb.Web, :view
end
| 15.25
| 30
| 0.786885
|
93b479fc15da7334772551ff8eec6112808479c5
| 61
|
ex
|
Elixir
|
lib/dgraph_ex/client/adapters.ex
|
sunny-g/dgraph_ex
|
fab9f1fd684538758ed211537c3b0869233e7ce4
|
[
"MIT"
] | 1
|
2019-05-01T15:18:41.000Z
|
2019-05-01T15:18:41.000Z
|
lib/dgraph_ex/client/adapters.ex
|
sunny-g/dgraph_ex
|
fab9f1fd684538758ed211537c3b0869233e7ce4
|
[
"MIT"
] | null | null | null |
lib/dgraph_ex/client/adapters.ex
|
sunny-g/dgraph_ex
|
fab9f1fd684538758ed211537c3b0869233e7ce4
|
[
"MIT"
] | 1
|
2019-05-01T15:18:48.000Z
|
2019-05-01T15:18:48.000Z
|
defmodule DgraphEx.Client.Adapters do
@moduledoc false
end
| 15.25
| 37
| 0.819672
|
93b491d7d7189f25c53d2b1093ab352e97241874
| 1,062
|
ex
|
Elixir
|
test/support/transport_sync.ex
|
hrzndhrn/json_rpc
|
c9a1d70b92abbf59260be6394bb5ecc41229a599
|
[
"MIT"
] | null | null | null |
test/support/transport_sync.ex
|
hrzndhrn/json_rpc
|
c9a1d70b92abbf59260be6394bb5ecc41229a599
|
[
"MIT"
] | null | null | null |
test/support/transport_sync.ex
|
hrzndhrn/json_rpc
|
c9a1d70b92abbf59260be6394bb5ecc41229a599
|
[
"MIT"
] | null | null | null |
defmodule Test.TransportSync do
@moduledoc false
@behaviour JsonRPC.Transport
alias JsonRPC.HandleRequestError
alias Test.Calls
require Logger
@impl true
def send_rpc(json, _opts) do
# simulate sending
with :ok <- mock(json) do
server(json)
end
end
defp server(json) do
# simulate a server with pre-decoded JSON
json
|> Jason.decode!()
|> JsonRPC.handle_request(Calls)
|> response()
rescue
error in HandleRequestError ->
Logger.error(Exception.message(error))
error |> JsonRPC.handle_error() |> response()
end
defp response(:notification), do: :ok
defp response(json), do: json |> Jason.encode!() |> client()
defp client(response), do: {:ok, response}
defp mock(json) do
cond do
Regex.match?(~r/method.*invalid_response/, json) ->
{:ok, "invalid"}
Regex.match?(~r/method.*send_failed/, json) ->
{:error, :send_failed}
Regex.match?(~r/params.*kaput/, json) ->
{:error, :kaput}
true ->
:ok
end
end
end
| 20.037736
| 62
| 0.620527
|
93b4aa33fbef9bcdab18d955d939c07a82449b6d
| 1,829
|
ex
|
Elixir
|
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1__label_frame.ex
|
MasashiYokota/elixir-google-api
|
975dccbff395c16afcb62e7a8e411fbb58e9ab01
|
[
"Apache-2.0"
] | null | null | null |
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1__label_frame.ex
|
MasashiYokota/elixir-google-api
|
975dccbff395c16afcb62e7a8e411fbb58e9ab01
|
[
"Apache-2.0"
] | 1
|
2020-12-18T09:25:12.000Z
|
2020-12-18T09:25:12.000Z
|
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1__label_frame.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.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1_LabelFrame do
@moduledoc """
Video frame level annotation results for label detection.
## Attributes
* `confidence` (*type:* `number()`, *default:* `nil`) - Confidence that the label is accurate. Range: [0, 1].
* `timeOffset` (*type:* `String.t`, *default:* `nil`) - Time-offset, relative to the beginning of the video, corresponding to the video frame for this location.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:confidence => number(),
:timeOffset => String.t()
}
field(:confidence)
field(:timeOffset)
end
defimpl Poison.Decoder,
for: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1_LabelFrame do
def decode(value, options) do
GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1_LabelFrame.decode(
value,
options
)
end
end
defimpl Poison.Encoder,
for: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1_LabelFrame do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 33.254545
| 164
| 0.738655
|
93b4cff9ca0ba4efeff28e1a559d15af38cf129f
| 1,080
|
exs
|
Elixir
|
clients/firebase_storage/test/test_helper.exs
|
renovate-bot/elixir-google-api
|
1da34cd39b670c99f067011e05ab90af93fef1f6
|
[
"Apache-2.0"
] | 1
|
2021-12-20T03:40:53.000Z
|
2021-12-20T03:40:53.000Z
|
clients/firebase_storage/test/test_helper.exs
|
swansoffiee/elixir-google-api
|
9ea6d39f273fb430634788c258b3189d3613dde0
|
[
"Apache-2.0"
] | 1
|
2020-08-18T00:11:23.000Z
|
2020-08-18T00:44:16.000Z
|
clients/firebase_storage/test/test_helper.exs
|
dazuma/elixir-google-api
|
6a9897168008efe07a6081d2326735fe332e522c
|
[
"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.
ExUnit.start()
defmodule GoogleApi.FirebaseStorage.TestHelper do
defmacro __using__(opts) do
quote do
use ExUnit.Case, unquote(opts)
import GoogleApi.FirebaseStorage.TestHelper
end
end
def for_scope(scopes) when is_list(scopes), do: for_scope(Enum.join(scopes, " "))
def for_scope(scope) do
{:ok, token} = Goth.Token.for_scope(scope)
token.token
end
end
| 30
| 83
| 0.742593
|
93b4e8d7cf0b38a493a1d55af632cbedc7760444
| 1,380
|
ex
|
Elixir
|
test/support/data_case.ex
|
corka149/jarvis
|
66ddb3d919323aaf39be15e937c28cc8cc805e40
|
[
"MIT"
] | null | null | null |
test/support/data_case.ex
|
corka149/jarvis
|
66ddb3d919323aaf39be15e937c28cc8cc805e40
|
[
"MIT"
] | 7
|
2019-05-25T06:39:46.000Z
|
2021-02-13T11:24:50.000Z
|
test/support/data_case.ex
|
corka149/jarvis
|
66ddb3d919323aaf39be15e937c28cc8cc805e40
|
[
"MIT"
] | null | null | null |
defmodule Jarvis.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
You may define functions here to be used as helpers in
your tests.
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
alias Ecto.Adapters.SQL.Sandbox
using do
quote do
alias Jarvis.Repo
import Ecto
import Ecto.Changeset
import Ecto.Query
import Jarvis.DataCase
end
end
setup tags do
:ok = Sandbox.checkout(Jarvis.Repo)
unless tags[:async] do
Sandbox.mode(Jarvis.Repo, {:shared, self()})
end
:ok
end
@doc """
A helper that transforms changeset errors into a map of messages.
assert {:error, changeset} = Accounts.create_user(%{password: "short"})
assert "password is too short" in errors_on(changeset).password
assert %{password: ["password is too short"]} = errors_on(changeset)
"""
def errors_on(changeset) do
Ecto.Changeset.traverse_errors(changeset, fn {message, opts} ->
Enum.reduce(opts, message, fn {key, value}, acc ->
String.replace(acc, "%{#{key}}", to_string(value))
end)
end)
end
end
| 24.642857
| 77
| 0.677536
|
93b4ffe23fb027c323478119e25b6d7600b260ee
| 63
|
ex
|
Elixir
|
lib/entrance_web/views/page_view.ex
|
exchange-prototype/Entrance
|
3edea9ffa2675c0580c7df43002b9e6cc275d60d
|
[
"Apache-2.0"
] | null | null | null |
lib/entrance_web/views/page_view.ex
|
exchange-prototype/Entrance
|
3edea9ffa2675c0580c7df43002b9e6cc275d60d
|
[
"Apache-2.0"
] | null | null | null |
lib/entrance_web/views/page_view.ex
|
exchange-prototype/Entrance
|
3edea9ffa2675c0580c7df43002b9e6cc275d60d
|
[
"Apache-2.0"
] | null | null | null |
defmodule EntranceWeb.PageView do
use EntranceWeb, :view
end
| 15.75
| 33
| 0.809524
|
93b5111bd6072472300c557139c0f0693e0d5b16
| 3,167
|
ex
|
Elixir
|
{{cookiecutter.app_name}}/lib/{{cookiecutter.app_name}}/accounts/user.ex
|
StephaneRob/cookiecutter-phoenix
|
c71a01a582fe8d57999d646cea7cbd820a4c73ca
|
[
"BSD-2-Clause"
] | 4
|
2018-01-16T15:40:04.000Z
|
2020-01-11T19:34:42.000Z
|
{{cookiecutter.app_name}}/lib/{{cookiecutter.app_name}}/accounts/user.ex
|
StephaneRob/cookiecutter-phoenix
|
c71a01a582fe8d57999d646cea7cbd820a4c73ca
|
[
"BSD-2-Clause"
] | 4
|
2018-03-10T14:18:37.000Z
|
2018-03-13T20:43:06.000Z
|
{{cookiecutter.app_name}}/lib/{{cookiecutter.app_name}}/accounts/user.ex
|
StephaneRob/cookiecutter-phoenix
|
c71a01a582fe8d57999d646cea7cbd820a4c73ca
|
[
"BSD-2-Clause"
] | 1
|
2019-10-11T20:52:31.000Z
|
2019-10-11T20:52:31.000Z
|
defmodule {{cookiecutter.app_name.split('_')|map('title')|join}}.Accounts.User do
use Ecto.Schema
use Timex.Ecto.Timestamps
import Ecto.Changeset
alias {{cookiecutter.app_name.split('_')|map('title')|join}}.{Repo, Accounts}
alias {{cookiecutter.app_name.split('_')|map('title')|join}}.Accounts.User
schema "users" do
field(:name, :string)
field(:email, :string)
field(:password, :string, virtual: true)
field(:password_confirmation, :string, virtual: true)
field(:encrypted_password, :string)
field(:suspended_at, Timex.Ecto.DateTime)
field(:confirmation_token, :string)
field(:confirmed_at, Timex.Ecto.DateTime)
field(:confirmation_sent_at, Timex.Ecto.DateTime)
# Only if using reconfirmable
field(:unconfirmed_email, :string)
## Recoverable
field(:reset_password_token, :string)
field(:reset_password_sent_at, Timex.Ecto.DateTime)
## Rememberable
field(:remember_created_at, Timex.Ecto.DateTime)
## Trackable
field(:sign_in_count, :integer)
field(:current_sign_in_at, Timex.Ecto.DateTime)
field(:last_sign_in_at, Timex.Ecto.DateTime)
field(:current_sign_in_ip, :string)
field(:last_sign_in_ip, :string)
## Lockable
# Only if lock strategy is :failed_attempts
field(:failed_attempts, :integer)
# Only if unlock strategy is :email or :both
field(:unlock_token, :string)
field(:locked_at, Timex.Ecto.DateTime)
## Admin
field(:admin, :boolean)
timestamps()
end
@doc false
def create_changeset(%User{} = user, attrs) do
user
|> cast(attrs, [:name, :email, :password])
|> validate_required([:name, :email, :password])
|> unsafe_validate_unique(:name, Repo)
|> unsafe_validate_unique(:email, Repo)
|> validate_length(:password, min: 6)
|> validate_format(:email, ~r/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$\z/i)
|> encrypt_password()
|> put_change(:confirmation_token, generate_token(:confirmation_token))
|> put_change(:confirmation_sent_at, Timex.now())
end
defp encrypt_password(changeset) do
put_change(changeset, :encrypted_password, hash_password(changeset.changes[:password]))
end
defp hash_password(password) when password in ["", nil], do: nil
defp hash_password(password) do
Comeonin.Bcrypt.hashpwsalt(password)
end
def generate_token(token_name, length \\ 24) do
token =
length
|> :crypto.strong_rand_bytes()
|> Base.url_encode64()
|> binary_part(0, length)
case Accounts.get_user_by(token_name, token) do
nil -> token
_ -> generate_token(token_name, length)
end
end
def generate_reset_password_token(%User{} = user) do
user
|> change(%{
reset_password_sent_at: Timex.now(),
reset_password_token: generate_token(:reset_password_token, 24)
})
end
def reset_password_changeset(%User{} = user, attrs) do
user
|> cast(attrs, [:password, :password_confirmation])
|> validate_required([:password, :password_confirmation])
|> validate_confirmation(:password)
end
def set_password(changeset) do
changeset
|> encrypt_password()
end
end
| 29.324074
| 91
| 0.684875
|
93b52c65955ebd1668e29620f4d021472b390a26
| 1,785
|
ex
|
Elixir
|
clients/compute/lib/google_api/compute/v1/model/customer_encryption_key.ex
|
hauptbenutzer/elixir-google-api
|
7b9e3a114a49cfc774a7afd03e299a0d43e4e6b2
|
[
"Apache-2.0"
] | null | null | null |
clients/compute/lib/google_api/compute/v1/model/customer_encryption_key.ex
|
hauptbenutzer/elixir-google-api
|
7b9e3a114a49cfc774a7afd03e299a0d43e4e6b2
|
[
"Apache-2.0"
] | null | null | null |
clients/compute/lib/google_api/compute/v1/model/customer_encryption_key.ex
|
hauptbenutzer/elixir-google-api
|
7b9e3a114a49cfc774a7afd03e299a0d43e4e6b2
|
[
"Apache-2.0"
] | 1
|
2020-11-10T16:58:27.000Z
|
2020-11-10T16:58:27.000Z
|
# 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.Compute.V1.Model.CustomerEncryptionKey do
@moduledoc """
Represents a customer-supplied encryption key
## Attributes
- rawKey (String.t): Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. Defaults to: `null`.
- sha256 (String.t): [Output only] The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. Defaults to: `null`.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:rawKey => any(),
:sha256 => any()
}
field(:rawKey)
field(:sha256)
end
defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.CustomerEncryptionKey do
def decode(value, options) do
GoogleApi.Compute.V1.Model.CustomerEncryptionKey.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.CustomerEncryptionKey do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 35
| 168
| 0.745658
|
93b54fca31b4680fb0884776fef80476ae9ffd52
| 501
|
ex
|
Elixir
|
apps/nightcrawler_web/lib/nightcrawler_web/views/error_view.ex
|
ZucchiniZe/nightcrawler_elixir
|
be82b0e7c25f55c7d2c2d3aa2860371cb68aeeb6
|
[
"MIT"
] | null | null | null |
apps/nightcrawler_web/lib/nightcrawler_web/views/error_view.ex
|
ZucchiniZe/nightcrawler_elixir
|
be82b0e7c25f55c7d2c2d3aa2860371cb68aeeb6
|
[
"MIT"
] | null | null | null |
apps/nightcrawler_web/lib/nightcrawler_web/views/error_view.ex
|
ZucchiniZe/nightcrawler_elixir
|
be82b0e7c25f55c7d2c2d3aa2860371cb68aeeb6
|
[
"MIT"
] | null | null | null |
defmodule NightcrawlerWeb.ErrorView do
use NightcrawlerWeb, :view
# If you want to customize a particular status code
# for a certain format, you may uncomment below.
# def render("500.html", _assigns) do
# "Internal Server Error"
# end
# By default, Phoenix returns the status message from
# the template name. For example, "404.html" becomes
# "Not Found".
def template_not_found(template, _assigns) do
Phoenix.Controller.status_message_from_template(template)
end
end
| 29.470588
| 61
| 0.740519
|
93b5830bddd7b166b1eeed35a15c9afea5e41f56
| 1,544
|
ex
|
Elixir
|
dei_app/lib/dei_app_web/views/error_helpers.ex
|
mbta/DEI-dashboard
|
7446c1d5497b388f337df554ef1109b8b9b0f606
|
[
"MIT"
] | 1
|
2020-09-18T19:41:07.000Z
|
2020-09-18T19:41:07.000Z
|
dei_app/lib/dei_app_web/views/error_helpers.ex
|
mbta/DEI-dashboard
|
7446c1d5497b388f337df554ef1109b8b9b0f606
|
[
"MIT"
] | 4
|
2020-07-23T02:35:33.000Z
|
2020-09-21T14:55:32.000Z
|
dei_app/lib/dei_app_web/views/error_helpers.ex
|
mbta/DEI-dashboard
|
7446c1d5497b388f337df554ef1109b8b9b0f606
|
[
"MIT"
] | null | null | null |
defmodule DeiAppWeb.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
use Phoenix.HTML
@doc """
Generates tag for inlined form input errors.
"""
def error_tag(form, field) do
Enum.map(Keyword.get_values(form.errors, field), fn error ->
content_tag(:span, translate_error(error),
class: "invalid-feedback",
phx_feedback_for: input_id(form, field)
)
end)
end
@doc """
Translates an error message using gettext.
"""
def translate_error({msg, opts}) do
# When using gettext, we typically pass the strings we want
# to translate as a static argument:
#
# # Translate "is invalid" in the "errors" domain
# dgettext("errors", "is invalid")
#
# # Translate the number of files with plural rules
# dngettext("errors", "1 file", "%{count} files", count)
#
# Because the error messages we show in our forms and APIs
# are defined inside Ecto, we need to translate them dynamically.
# This requires us to call the Gettext module passing our gettext
# backend as first argument.
#
# Note we use the "errors" domain, which means translations
# should be written to the errors.po file. The :count option is
# set by Ecto and indicates we should also apply plural rules.
if count = opts[:count] do
Gettext.dngettext(DeiAppWeb.Gettext, "errors", msg, msg, count, opts)
else
Gettext.dgettext(DeiAppWeb.Gettext, "errors", msg, opts)
end
end
end
| 32.166667
| 75
| 0.664508
|
93b58e1c316ba8626a6cbe35dca02cabbbec77b0
| 638
|
ex
|
Elixir
|
lib/creep/packet/unsuback.ex
|
ConnorRigby/creep
|
91d503187fda50b20788244487ca7d412373893c
|
[
"ISC"
] | 13
|
2019-09-21T04:48:09.000Z
|
2022-01-26T13:13:03.000Z
|
lib/creep/packet/unsuback.ex
|
ConnorRigby/creep
|
91d503187fda50b20788244487ca7d412373893c
|
[
"ISC"
] | null | null | null |
lib/creep/packet/unsuback.ex
|
ConnorRigby/creep
|
91d503187fda50b20788244487ca7d412373893c
|
[
"ISC"
] | 1
|
2020-03-03T16:50:42.000Z
|
2020-03-03T16:50:42.000Z
|
defmodule Creep.Packet.Unsuback do
alias Creep.Packet.Unsuback
@type t() :: %Unsuback{
packet_id: integer()
}
defstruct [
:packet_id
]
defimpl Creep.Packet.Encode, for: Unsuback do
@type_unsuback 0xB
def encode(%Unsuback{packet_id: packet_id}) do
<<@type_unsuback::4, 0::4, 2::8, packet_id::16>>
end
end
defimpl Creep.Packet.Decode, for: Unsuback do
@type_unsuback 0xB
def decode(%Unsuback{} = packet, <<
@type_unsuback::4,
_reserved::4,
2::8,
packet_id::16
>>) do
%{packet | packet_id: packet_id}
end
end
end
| 19.333333
| 54
| 0.586207
|
93b59aec52de055394f409fdd3cdd2136c7d16e3
| 2,673
|
ex
|
Elixir
|
kousa/lib/broth/message/call.ex
|
asgarovf/dogehouse
|
12b81d2008562373591fb55ab8179a3fa8a5db18
|
[
"MIT"
] | 2
|
2021-05-01T16:57:50.000Z
|
2021-07-07T22:01:14.000Z
|
kousa/lib/broth/message/call.ex
|
asgarovf/dogehouse
|
12b81d2008562373591fb55ab8179a3fa8a5db18
|
[
"MIT"
] | null | null | null |
kousa/lib/broth/message/call.ex
|
asgarovf/dogehouse
|
12b81d2008562373591fb55ab8179a3fa8a5db18
|
[
"MIT"
] | null | null | null |
defmodule Broth.Message.Call do
@moduledoc """
API contract statement for call message modules
## Usage:
```elixir
using Broth.Message.Call, reply: <module>
```
if you omit the reply module, it assumes the value
`__MODULE__.Reply`
performs compile-time checks to validate that the reply module
is, indeed, a reply module.
If this route can be used without authorization, set the
`:needs_auth` keyword parameter to false.
"""
defmacro __using__(opts) do
default_reply_module = Module.concat(__CALLER__.module, Reply)
reply_module =
opts
|> Keyword.get(:reply, default_reply_module)
|> Macro.expand(__CALLER__)
directions =
if reply_module == __CALLER__.module do
[:inbound, :outbound]
else
[:outbound]
end
auth_check =
opts
|> Keyword.get(:needs_auth, true)
|> auth_check()
quote do
use Ecto.Schema
import Ecto.Changeset
@after_compile Broth.Message.Call
@behaviour Broth.Message.Call
Module.register_attribute(__MODULE__, :directions, accumulate: true, persist: true)
@directions unquote(directions)
unquote(auth_check)
@impl true
def reply_module, do: unquote(reply_module)
@impl true
def initialize(_state), do: struct(__MODULE__)
defoverridable initialize: 1
end
end
def auth_check(true) do
quote do
@impl true
def auth_check(%{user_id: nil}), do: {:error, :auth}
def auth_check(_), do: :ok
end
end
def auth_check(false) do
quote do
@impl true
def auth_check(_), do: :ok
end
end
alias Ecto.Changeset
alias Broth.SocketHandler
@callback auth_check(SocketHandler.state()) :: :ok | {:error, :auth}
@callback reply_module() :: module
@callback execute(Changeset.t(), SocketHandler.state()) ::
{:reply, map, SocketHandler.state()}
| {:noreply, SocketHandler.state()}
| {:error, map, SocketHandler.state()}
| {:error, Changeset.t()}
| {:close, code :: 1000..9999, reason :: String.t()}
@callback initialize(SocketHandler.state()) :: struct
@callback changeset(struct | nil, Broth.json()) :: Ecto.Changeset.t()
@callback changeset(Broth.json()) :: Ecto.Changeset.t()
def __after_compile__(%{module: module}, _bin) do
reply_module = module.reply_module()
Code.ensure_loaded?(reply_module)
unless :outbound in reply_module.__info__(:attributes)[:directions] do
raise CompileError,
description: "reply module #{inspect(reply_module)} does not seem to be a outbound module"
end
end
end
| 25.216981
| 98
| 0.648709
|
93b5af60e9671ac562418185ef5e7bcf0ade7a77
| 1,497
|
ex
|
Elixir
|
lib/brando/blueprint/villain/blocks/svg_block.ex
|
univers-agency/brando
|
69c3c52498a3f64518da3522cd9f27294a52cc68
|
[
"Apache-2.0"
] | 1
|
2020-04-26T09:53:02.000Z
|
2020-04-26T09:53:02.000Z
|
lib/brando/blueprint/villain/blocks/svg_block.ex
|
univers-agency/brando
|
69c3c52498a3f64518da3522cd9f27294a52cc68
|
[
"Apache-2.0"
] | 198
|
2019-08-20T16:16:07.000Z
|
2020-07-03T15:42:07.000Z
|
lib/brando/blueprint/villain/blocks/svg_block.ex
|
univers-agency/brando
|
69c3c52498a3f64518da3522cd9f27294a52cc68
|
[
"Apache-2.0"
] | null | null | null |
defmodule Brando.Blueprint.Villain.Blocks.SvgBlock do
defmodule Data do
use Brando.Blueprint,
application: "Brando",
domain: "Villain",
schema: "SvgBlockData",
singular: "svg_block_data",
plural: "svg_block_datas",
gettext_module: Brando.Gettext
@primary_key false
data_layer :embedded
identifier "{{ entry.type }}"
attributes do
attribute :class, :text
attribute :code, :text
end
end
use Brando.Blueprint.Villain.Block,
type: "svg"
def protected_attrs do
[:code]
end
def apply_ref(Brando.Blueprint.Villain.Blocks.MediaBlock, ref_src, ref_target) do
# in order to not overwrite the chosen media block, we have to get the media
# block template and merge against this instead
tpl_src = ref_src.data.data.template_svg
protected_attrs = __MODULE__.protected_attrs()
overwritten_attrs = Map.keys(tpl_src) -- protected_attrs
new_attrs = Map.take(tpl_src, overwritten_attrs)
new_data = Map.merge(ref_target.data.data, new_attrs)
put_in(ref_target, [Access.key(:data), Access.key(:data)], new_data)
end
def apply_ref(_, ref_src, ref_target) do
protected_attrs = __MODULE__.protected_attrs()
overwritten_attrs = Map.keys(ref_src.data.data) -- protected_attrs
new_attrs = Map.take(ref_src.data.data, overwritten_attrs)
new_data = Map.merge(ref_target.data.data, new_attrs)
put_in(ref_target, [Access.key(:data), Access.key(:data)], new_data)
end
end
| 31.851064
| 83
| 0.710755
|
93b5b57f2daf196266d783de164a937d0885daa1
| 779
|
ex
|
Elixir
|
examples/interpreter-in-browser/www/ex_sample.ex
|
shaneutt/lumen
|
d3b7a006bb41c5afed8481a5784ef904fbca6ee2
|
[
"Apache-2.0"
] | 1
|
2019-12-15T01:06:38.000Z
|
2019-12-15T01:06:38.000Z
|
examples/interpreter-in-browser/www/ex_sample.ex
|
bryanjos/lumen
|
a7fe08be528d17f1d9b7c4821db7d639c097ff0a
|
[
"Apache-2.0"
] | 2
|
2021-03-11T06:55:42.000Z
|
2021-05-11T23:41:46.000Z
|
examples/interpreter-in-browser/www/ex_sample.ex
|
shaneutt/lumen
|
d3b7a006bb41c5afed8481a5784ef904fbca6ee2
|
[
"Apache-2.0"
] | null | null | null |
defmodule ExSample do
# NOTE: this file is not automatically compiled to .erl, please check the
# README.md file for more information.
def run_me(arg) do
:lumen_intrinsics.println("Doing the Lumen web work...")
{:ok, window} = Lumen.Web.Window.window()
{:ok, document} = Lumen.Web.Window.document(window)
{:ok, paragraph} = Lumen.Web.Document.create_element(document, "p")
text =
Lumen.Web.Document.create_text_node(
document,
"This text was created through Elixir in your browser."
)
:ok = Lumen.Web.Node.append_child(paragraph, text)
{:ok, output} = Lumen.Web.Document.get_element_by_id(document, "output")
:ok = Lumen.Web.Node.append_child(output, paragraph)
:lumen_intrinsics.println("Done!")
end
end
| 35.409091
| 76
| 0.686778
|
93b5c08a39158524f494be33de6962a7aa11d296
| 225
|
exs
|
Elixir
|
priv/repo/seeds/0001_settings.exs
|
ramkrishna70/opencov
|
7a3415f8eebb797ad1f7b6c832daa4f04d70af8d
|
[
"MIT"
] | 189
|
2018-09-25T09:02:41.000Z
|
2022-03-09T13:52:06.000Z
|
priv/repo/seeds/0001_settings.exs
|
ramkrishna70/opencov
|
7a3415f8eebb797ad1f7b6c832daa4f04d70af8d
|
[
"MIT"
] | 29
|
2018-09-26T05:51:18.000Z
|
2021-11-05T08:55:03.000Z
|
priv/repo/seeds/0001_settings.exs
|
ramkrishna70/opencov
|
7a3415f8eebb797ad1f7b6c832daa4f04d70af8d
|
[
"MIT"
] | 32
|
2018-10-21T12:28:11.000Z
|
2022-03-28T02:20:19.000Z
|
import Seedex
seed Opencov.Settings, fn settings ->
settings
|> Map.put(:id, 1)
|> Map.put(:signup_enabled, false)
|> Map.put(:restricted_signup_domains, "")
|> Map.put(:default_project_visibility, "internal")
end
| 22.5
| 53
| 0.697778
|
93b5ccd4c77cc7b1a8d62df211405c9cad1b38f1
| 531
|
exs
|
Elixir
|
test/surface_bulma_widgets_playground_web/views/error_view_test.exs
|
elcritch/surface_bulma_widgets_playground
|
380d1fed6b829e347ff92a29e7619c4076bcd83d
|
[
"MIT"
] | null | null | null |
test/surface_bulma_widgets_playground_web/views/error_view_test.exs
|
elcritch/surface_bulma_widgets_playground
|
380d1fed6b829e347ff92a29e7619c4076bcd83d
|
[
"MIT"
] | null | null | null |
test/surface_bulma_widgets_playground_web/views/error_view_test.exs
|
elcritch/surface_bulma_widgets_playground
|
380d1fed6b829e347ff92a29e7619c4076bcd83d
|
[
"MIT"
] | null | null | null |
defmodule SurfaceBulmaWidgetsPlaygroundWeb.ErrorViewTest do
use SurfaceBulmaWidgetsPlaygroundWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.html" do
assert render_to_string(SurfaceBulmaWidgetsPlaygroundWeb.ErrorView, "404.html", []) ==
"Not Found"
end
test "renders 500.html" do
assert render_to_string(SurfaceBulmaWidgetsPlaygroundWeb.ErrorView, "500.html", []) ==
"Internal Server Error"
end
end
| 31.235294
| 90
| 0.741996
|
93b5fade43a17cafd668189ca6f02979338b43f1
| 2,082
|
ex
|
Elixir
|
clients/monitoring/lib/google_api/monitoring/v3/model/mesh_istio.ex
|
mcrumm/elixir-google-api
|
544f22797cec52b3a23dfb6e39117f0018448610
|
[
"Apache-2.0"
] | null | null | null |
clients/monitoring/lib/google_api/monitoring/v3/model/mesh_istio.ex
|
mcrumm/elixir-google-api
|
544f22797cec52b3a23dfb6e39117f0018448610
|
[
"Apache-2.0"
] | 1
|
2020-12-18T09:25:12.000Z
|
2020-12-18T09:25:12.000Z
|
clients/monitoring/lib/google_api/monitoring/v3/model/mesh_istio.ex
|
mcrumm/elixir-google-api
|
544f22797cec52b3a23dfb6e39117f0018448610
|
[
"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.Model.MeshIstio do
@moduledoc """
Istio service scoped to an Istio mesh. Anthos clusters running ASM < 1.6.8 will have their services ingested as this type.
## Attributes
* `meshUid` (*type:* `String.t`, *default:* `nil`) - Identifier for the mesh in which this Istio service is defined. Corresponds to the mesh_uid metric label in Istio metrics.
* `serviceName` (*type:* `String.t`, *default:* `nil`) - The name of the Istio service underlying this service. Corresponds to the destination_service_name metric label in Istio metrics.
* `serviceNamespace` (*type:* `String.t`, *default:* `nil`) - The namespace of the Istio service underlying this service. Corresponds to the destination_service_namespace metric label in Istio metrics.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:meshUid => String.t(),
:serviceName => String.t(),
:serviceNamespace => String.t()
}
field(:meshUid)
field(:serviceName)
field(:serviceNamespace)
end
defimpl Poison.Decoder, for: GoogleApi.Monitoring.V3.Model.MeshIstio do
def decode(value, options) do
GoogleApi.Monitoring.V3.Model.MeshIstio.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.Monitoring.V3.Model.MeshIstio do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 39.283019
| 205
| 0.733429
|
93b60843f69a4cc3c9ea57bca1b002dfbc3370e4
| 5,102
|
ex
|
Elixir
|
apps/graphql/lib/graphql/schema/service_catalog/service_group_types.ex
|
ehealth-ua/ehealth.api
|
4ffe26a464fe40c95fb841a4aa2e147068f65ca2
|
[
"Apache-2.0"
] | 8
|
2019-06-14T11:34:49.000Z
|
2021-08-05T19:14:24.000Z
|
apps/graphql/lib/graphql/schema/service_catalog/service_group_types.ex
|
edenlabllc/ehealth.api.public
|
4ffe26a464fe40c95fb841a4aa2e147068f65ca2
|
[
"Apache-2.0"
] | 1
|
2019-07-08T15:20:22.000Z
|
2019-07-08T15:20:22.000Z
|
apps/graphql/lib/graphql/schema/service_catalog/service_group_types.ex
|
ehealth-ua/ehealth.api
|
4ffe26a464fe40c95fb841a4aa2e147068f65ca2
|
[
"Apache-2.0"
] | 6
|
2018-05-11T13:59:32.000Z
|
2022-01-19T20:15:22.000Z
|
defmodule GraphQL.Schema.ServiceGroupTypes do
@moduledoc false
use Absinthe.Schema.Notation
use Absinthe.Relay.Schema.Notation, :modern
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
import GraphQL.Resolvers.Helpers.Load, only: [load_by_args: 2]
alias Absinthe.Relay.Node.ParseIDs
alias Core.Services.ServiceGroup
alias GraphQL.Loaders.PRM
alias GraphQL.Middleware.Filtering
alias GraphQL.Resolvers.ServiceGroup, as: ServiceGroupResolver
object :service_group_queries do
connection field(:service_groups, node_type: :service_group) do
meta(:scope, ~w(service_catalog:read))
meta(:client_metadata, ~w(client_id client_type)a)
meta(:allowed_clients, ~w(NHS))
arg(:filter, :service_group_filter)
arg(:order_by, :service_group_order_by, default_value: :inserted_at_desc)
middleware(
Filtering,
database_id: :equal,
name: :like,
code: :like,
is_active: :equal,
parent_group: [
database_id: :equal,
name: :like,
code: :like,
is_active: :equal
]
)
resolve(&ServiceGroupResolver.list_service_groups/2)
end
field(:service_group, :service_group) do
meta(:scope, ~w(service_catalog:read))
meta(:client_metadata, ~w(client_id client_type)a)
meta(:allowed_clients, ~w(NHS))
arg(:id, non_null(:id))
middleware(ParseIDs, id: :service_group)
resolve(load_by_args(PRM, ServiceGroup))
end
end
input_object :service_group_filter do
field(:database_id, :uuid)
field(:name, :string)
field(:code, :string)
field(:is_active, :boolean)
field(:parent_group, :service_group_filter)
end
enum :service_group_order_by do
value(:code_asc)
value(:code_desc)
value(:inserted_at_asc)
value(:inserted_at_desc)
value(:name_asc)
value(:name_desc)
end
connection node_type: :service_group do
field :nodes, list_of(:service_group) do
resolve(fn _, %{source: conn} -> {:ok, Enum.map(conn.edges, & &1.node)} end)
end
edge(do: nil)
end
object :service_group_mutations do
payload field(:create_service_group) do
meta(:scope, ~w(service_catalog:write))
meta(:client_metadata, ~w(consumer_id client_type)a)
meta(:allowed_clients, ~w(NHS))
input do
field(:name, non_null(:string))
field(:code, non_null(:string))
field(:request_allowed, :boolean)
field(:parent_group_id, :id)
end
output do
field(:service_group, :service_group)
end
middleware(ParseIDs, parent_group_id: :service_group)
resolve(&ServiceGroupResolver.create/2)
end
payload field(:deactivate_service_group) do
meta(:scope, ~w(service_catalog:write))
meta(:client_metadata, ~w(consumer_id client_type)a)
meta(:allowed_clients, ~w(NHS))
input do
field(:id, non_null(:id))
end
output do
field(:service_group, :service_group)
end
middleware(ParseIDs, id: :service_group)
resolve(&ServiceGroupResolver.deactivate/2)
end
payload field(:add_service_to_group) do
meta(:scope, ~w(service_catalog:write))
meta(:client_metadata, ~w(consumer_id client_type)a)
meta(:allowed_clients, ~w(NHS))
input do
field(:service_id, non_null(:id))
field(:service_group_id, non_null(:id))
end
output do
field(:service_group, :service_group)
end
middleware(ParseIDs, service_id: :service, service_group_id: :service_group)
resolve(&ServiceGroupResolver.add_service_to_group/2)
end
payload field(:delete_service_from_group) do
meta(:scope, ~w(service_catalog:write))
meta(:client_metadata, ~w(consumer_id client_type)a)
meta(:allowed_clients, ~w(NHS))
input do
field(:service_id, non_null(:id))
field(:service_group_id, non_null(:id))
end
output do
field(:service_group, :service_group)
end
middleware(ParseIDs, service_id: :service, service_group_id: :service_group)
resolve(&ServiceGroupResolver.delete_service_from_group/2)
end
end
node object(:service_group) do
field(:database_id, non_null(:uuid))
field(:name, non_null(:string))
field(:code, non_null(:string))
field(:is_active, non_null(:boolean))
field(:request_allowed, non_null(:boolean))
field(:parent_group, :service_group, resolve: dataloader(PRM))
connection field(:sub_groups, node_type: :service_group) do
arg(:filter, :service_group_filter)
arg(:order_by, :service_group_order_by, default_value: :inserted_at_desc)
resolve(&ServiceGroupResolver.load_sub_groups/3)
end
connection field(:services, node_type: :service) do
arg(:filter, :service_filter)
arg(:order_by, :service_order_by, default_value: :inserted_at_desc)
resolve(&ServiceGroupResolver.load_services/3)
end
field(:inserted_at, non_null(:datetime))
field(:updated_at, non_null(:datetime))
end
end
| 28.187845
| 82
| 0.676009
|
93b6202097478b0d599a0327f2c8f60f7f5fecd6
| 7,935
|
ex
|
Elixir
|
clients/jobs/lib/google_api/jobs/v2/model/job_query.ex
|
chingor13/elixir-google-api
|
85e13fa25c4c9f4618bb463ab4c79245fc6d2a7b
|
[
"Apache-2.0"
] | 1
|
2018-12-03T23:43:10.000Z
|
2018-12-03T23:43:10.000Z
|
clients/jobs/lib/google_api/jobs/v2/model/job_query.ex
|
chingor13/elixir-google-api
|
85e13fa25c4c9f4618bb463ab4c79245fc6d2a7b
|
[
"Apache-2.0"
] | null | null | null |
clients/jobs/lib/google_api/jobs/v2/model/job_query.ex
|
chingor13/elixir-google-api
|
85e13fa25c4c9f4618bb463ab4c79245fc6d2a7b
|
[
"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.Jobs.V2.Model.JobQuery do
@moduledoc """
Input only.
The query required to perform a search query or histogram.
## Attributes
* `categories` (*type:* `list(String.t)`, *default:* `nil`) - Optional.
The category filter specifies the categories of jobs to search against.
See Category for more information.
If a value is not specified, jobs from any category are searched against.
If multiple values are specified, jobs from any of the specified
categories are searched against.
* `commuteFilter` (*type:* `GoogleApi.Jobs.V2.Model.CommutePreference.t`, *default:* `nil`) - Optional.
Allows filtering jobs by commute time with different travel methods (for
example, driving or public transit). Note: This only works with COMMUTE
MODE. When specified, [JobQuery.location_filters] is
ignored.
Currently we don't support sorting by commute time.
* `companyDisplayNames` (*type:* `list(String.t)`, *default:* `nil`) - Optional.
This filter specifies the exact company display
name of the jobs to search against.
If a value isn't specified, jobs within the search results are
associated with any company.
If multiple values are specified, jobs within the search results may be
associated with any of the specified companies.
At most 20 company display name filters are allowed.
* `companyNames` (*type:* `list(String.t)`, *default:* `nil`) - Optional.
This filter specifies the company entities to search against.
If a value isn't specified, jobs are searched for against all
companies.
If multiple values are specified, jobs are searched against the
companies specified.
At most 20 company filters are allowed.
* `compensationFilter` (*type:* `GoogleApi.Jobs.V2.Model.CompensationFilter.t`, *default:* `nil`) - Optional.
This search filter is applied only to
Job.compensation_info. For example, if the filter is specified
as "Hourly job with per-hour compensation > $15", only jobs meeting
these criteria are searched. If a filter isn't defined, all open jobs
are searched.
* `customAttributeFilter` (*type:* `String.t`, *default:* `nil`) - Optional.
This filter specifies a structured syntax to match against the
Job.custom_attributes marked as `filterable`.
The syntax for this expression is a subset of Google SQL syntax.
Supported operators are: =, !=, <, <=, >, >= where the left of the operator
is a custom field key and the right of the operator is a number or string
(surrounded by quotes) value.
Supported functions are LOWER(<field_name>) to
perform case insensitive match and EMPTY(<field_name>) to filter on the
existence of a key.
Boolean expressions (AND/OR/NOT) are supported up to 3 levels of
nesting (for example, "((A AND B AND C) OR NOT D) AND E"), a maximum of 50
comparisons/functions are allowed in the expression. The expression
must be < 2000 characters in length.
Sample Query:
(key1 = "TEST" OR LOWER(key1)="test" OR NOT EMPTY(key1)) AND key2 > 100
* `disableSpellCheck` (*type:* `boolean()`, *default:* `nil`) - Optional.
This flag controls the spell-check feature. If false, the
service attempts to correct a misspelled query,
for example, "enginee" is corrected to "engineer".
Defaults to false: a spell check is performed.
* `employmentTypes` (*type:* `list(String.t)`, *default:* `nil`) - Optional.
The employment type filter specifies the employment type of jobs to
search against, such as EmploymentType.FULL_TIME.
If a value is not specified, jobs in the search results include any
employment type.
If multiple values are specified, jobs in the search results include
any of the specified employment types.
* `languageCodes` (*type:* `list(String.t)`, *default:* `nil`) - Optional.
This filter specifies the locale of jobs to search against,
for example, "en-US".
If a value isn't specified, the search results can contain jobs in any
locale.
Language codes should be in BCP-47 format, such as "en-US" or "sr-Latn".
For more information, see
[Tags for Identifying Languages](https://tools.ietf.org/html/bcp47).
At most 10 language code filters are allowed.
* `locationFilters` (*type:* `list(GoogleApi.Jobs.V2.Model.LocationFilter.t)`, *default:* `nil`) - Optional.
The location filter specifies geo-regions containing the jobs to
search against. See LocationFilter for more information.
If a location value isn't specified, jobs fitting the other search
criteria are retrieved regardless of where they're located.
If multiple values are specified, jobs are retrieved from any of the
specified locations. If different values are specified for the
LocationFilter.distance_in_miles parameter, the maximum provided
distance is used for all locations.
At most 5 location filters are allowed.
* `publishDateRange` (*type:* `String.t`, *default:* `nil`) - Optional.
Jobs published within a range specified by this filter are searched
against, for example, DateRange.PAST_MONTH. If a value isn't
specified, all open jobs are searched against regardless of their
published date.
* `query` (*type:* `String.t`, *default:* `nil`) - Optional.
The query string that matches against the job title, description, and
location fields.
The maximum query size is 255 bytes.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:categories => list(String.t()),
:commuteFilter => GoogleApi.Jobs.V2.Model.CommutePreference.t(),
:companyDisplayNames => list(String.t()),
:companyNames => list(String.t()),
:compensationFilter => GoogleApi.Jobs.V2.Model.CompensationFilter.t(),
:customAttributeFilter => String.t(),
:disableSpellCheck => boolean(),
:employmentTypes => list(String.t()),
:languageCodes => list(String.t()),
:locationFilters => list(GoogleApi.Jobs.V2.Model.LocationFilter.t()),
:publishDateRange => String.t(),
:query => String.t()
}
field(:categories, type: :list)
field(:commuteFilter, as: GoogleApi.Jobs.V2.Model.CommutePreference)
field(:companyDisplayNames, type: :list)
field(:companyNames, type: :list)
field(:compensationFilter, as: GoogleApi.Jobs.V2.Model.CompensationFilter)
field(:customAttributeFilter)
field(:disableSpellCheck)
field(:employmentTypes, type: :list)
field(:languageCodes, type: :list)
field(:locationFilters, as: GoogleApi.Jobs.V2.Model.LocationFilter, type: :list)
field(:publishDateRange)
field(:query)
end
defimpl Poison.Decoder, for: GoogleApi.Jobs.V2.Model.JobQuery do
def decode(value, options) do
GoogleApi.Jobs.V2.Model.JobQuery.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.Jobs.V2.Model.JobQuery do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 40.484694
| 113
| 0.696282
|
93b63d9c93a3c510f73e3bc253b5e975a43a789e
| 102
|
exs
|
Elixir
|
test/rfx/change/req_test.exs
|
doorgan/rfx
|
566b8623ce8957632329b4b0a142ea26a46f2301
|
[
"MIT"
] | null | null | null |
test/rfx/change/req_test.exs
|
doorgan/rfx
|
566b8623ce8957632329b4b0a142ea26a46f2301
|
[
"MIT"
] | null | null | null |
test/rfx/change/req_test.exs
|
doorgan/rfx
|
566b8623ce8957632329b4b0a142ea26a46f2301
|
[
"MIT"
] | null | null | null |
defmodule Rfx.Change.ReqTest do
use ExUnit.Case
test "placeholder" do
assert true
end
end
| 11.333333
| 31
| 0.715686
|
93b6699eb19bc7d2266a2d8d17b6a74b43365832
| 228
|
ex
|
Elixir
|
lib/ws/auth/resource.ex
|
zekroTJA/imgserver
|
a2efc3483bc83cc9734dbef7ca9bd3dc4a19bb64
|
[
"MIT"
] | null | null | null |
lib/ws/auth/resource.ex
|
zekroTJA/imgserver
|
a2efc3483bc83cc9734dbef7ca9bd3dc4a19bb64
|
[
"MIT"
] | null | null | null |
lib/ws/auth/resource.ex
|
zekroTJA/imgserver
|
a2efc3483bc83cc9734dbef7ca9bd3dc4a19bb64
|
[
"MIT"
] | null | null | null |
defmodule Imgserver.Ws.Auth.Resource do
@moduledoc """
Holds information about the authenticated
session or user.
"""
@type t :: %__MODULE__{
session_id: String.t()
}
defstruct session_id: ""
end
| 17.538462
| 43
| 0.644737
|
93b67f7c3d26bce5c44716814012b6017121b27e
| 12,930
|
ex
|
Elixir
|
clients/drive/lib/google_api/drive/v3/api/teamdrives.ex
|
matehat/elixir-google-api
|
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
|
[
"Apache-2.0"
] | 1
|
2018-12-03T23:43:10.000Z
|
2018-12-03T23:43:10.000Z
|
clients/drive/lib/google_api/drive/v3/api/teamdrives.ex
|
matehat/elixir-google-api
|
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
|
[
"Apache-2.0"
] | null | null | null |
clients/drive/lib/google_api/drive/v3/api/teamdrives.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.Drive.V3.Api.Teamdrives do
@moduledoc """
API calls for all endpoints tagged `Teamdrives`.
"""
alias GoogleApi.Drive.V3.Connection
alias GoogleApi.Gax.{Request, Response}
@doc """
Deprecated use drives.create instead.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `request_id` (*type:* `String.t`) - An ID, such as a random UUID, which uniquely identifies this user's request for idempotent creation of a Team Drive. A repeated request by the same user and with the same request ID will avoid creating duplicates by attempting to create the same Team Drive. If the Team Drive already exists a 409 error will be returned.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `: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`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:body` (*type:* `GoogleApi.Drive.V3.Model.TeamDrive.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.TeamDrive{}}` on success
* `{:error, info}` on failure
"""
@spec drive_teamdrives_create(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.TeamDrive.t()} | {:error, Tesla.Env.t()}
def drive_teamdrives_create(connection, request_id, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/drive/v3/teamdrives", %{})
|> Request.add_param(:query, :requestId, request_id)
|> Request.add_optional_params(optional_params_config, optional_params)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.TeamDrive{}])
end
@doc """
Deprecated use drives.delete instead.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `team_drive_id` (*type:* `String.t`) - The ID of the Team Drive
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `: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`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %{}}` on success
* `{:error, info}` on failure
"""
@spec drive_teamdrives_delete(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, nil} | {:error, Tesla.Env.t()}
def drive_teamdrives_delete(connection, team_drive_id, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url("/drive/v3/teamdrives/{teamDriveId}", %{
"teamDriveId" => URI.encode(team_drive_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [decode: false])
end
@doc """
Deprecated use drives.get instead.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `team_drive_id` (*type:* `String.t`) - The ID of the Team Drive
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `: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`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:useDomainAdminAccess` (*type:* `boolean()`) - Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.TeamDrive{}}` on success
* `{:error, info}` on failure
"""
@spec drive_teamdrives_get(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.TeamDrive.t()} | {:error, Tesla.Env.t()}
def drive_teamdrives_get(connection, team_drive_id, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:useDomainAdminAccess => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/drive/v3/teamdrives/{teamDriveId}", %{
"teamDriveId" => URI.encode(team_drive_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.TeamDrive{}])
end
@doc """
Deprecated use drives.list instead.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `: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`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:pageSize` (*type:* `integer()`) - Maximum number of Team Drives to return.
* `:pageToken` (*type:* `String.t`) - Page token for Team Drives.
* `:q` (*type:* `String.t`) - Query string for searching Team Drives.
* `:useDomainAdminAccess` (*type:* `boolean()`) - Issue the request as a domain administrator; if set to true, then all Team Drives of the domain in which the requester is an administrator are returned.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.TeamDriveList{}}` on success
* `{:error, info}` on failure
"""
@spec drive_teamdrives_list(Tesla.Env.client(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.TeamDriveList.t()} | {:error, Tesla.Env.t()}
def drive_teamdrives_list(connection, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:pageSize => :query,
:pageToken => :query,
:q => :query,
:useDomainAdminAccess => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/drive/v3/teamdrives", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.TeamDriveList{}])
end
@doc """
Deprecated use drives.update instead
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `team_drive_id` (*type:* `String.t`) - The ID of the Team Drive
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `: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`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:useDomainAdminAccess` (*type:* `boolean()`) - Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.
* `:body` (*type:* `GoogleApi.Drive.V3.Model.TeamDrive.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.TeamDrive{}}` on success
* `{:error, info}` on failure
"""
@spec drive_teamdrives_update(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.TeamDrive.t()} | {:error, Tesla.Env.t()}
def drive_teamdrives_update(connection, team_drive_id, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:useDomainAdminAccess => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url("/drive/v3/teamdrives/{teamDriveId}", %{
"teamDriveId" => URI.encode(team_drive_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.TeamDrive{}])
end
end
| 46.510791
| 362
| 0.641222
|
93b6924f079d084fe97a8e86cc598ad9c47ef172
| 1,786
|
exs
|
Elixir
|
clients/docs/mix.exs
|
kyleVsteger/elixir-google-api
|
3a0dd498af066a4361b5b0fd66ffc04a57539488
|
[
"Apache-2.0"
] | null | null | null |
clients/docs/mix.exs
|
kyleVsteger/elixir-google-api
|
3a0dd498af066a4361b5b0fd66ffc04a57539488
|
[
"Apache-2.0"
] | null | null | null |
clients/docs/mix.exs
|
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.Docs.Mixfile do
use Mix.Project
@version "0.12.0"
def project() do
[
app: :google_api_docs,
version: @version,
elixir: "~> 1.6",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
description: description(),
package: package(),
deps: deps(),
source_url: "https://github.com/googleapis/elixir-google-api/tree/master/clients/docs"
]
end
def application() do
[extra_applications: [:logger]]
end
defp deps() do
[
{:google_gax, "~> 0.4"},
{:ex_doc, "~> 0.16", only: :dev}
]
end
defp description() do
"""
Google Docs API client library. Reads and writes Google Docs documents.
"""
end
defp package() do
[
files: ["lib", "mix.exs", "README*", "LICENSE"],
maintainers: ["Jeff Ching", "Daniel Azuma"],
licenses: ["Apache 2.0"],
links: %{
"GitHub" => "https://github.com/googleapis/elixir-google-api/tree/master/clients/docs",
"Homepage" => "https://developers.google.com/docs/"
}
]
end
end
| 26.656716
| 95
| 0.647816
|
93b6ab1eee42bdca72ca297e5a735d4a3c382314
| 12,102
|
ex
|
Elixir
|
lib/elixir_ex_aliyun_ots_table_store_search_match_query.ex
|
hou8/tablestore_protos
|
1a3223326b92bbe196d57ce4dd19b5a8db1c728d
|
[
"MIT"
] | null | null | null |
lib/elixir_ex_aliyun_ots_table_store_search_match_query.ex
|
hou8/tablestore_protos
|
1a3223326b92bbe196d57ce4dd19b5a8db1c728d
|
[
"MIT"
] | 1
|
2022-02-08T06:37:02.000Z
|
2022-02-08T06:37:02.000Z
|
lib/elixir_ex_aliyun_ots_table_store_search_match_query.ex
|
hou8/tablestore_protos
|
1a3223326b92bbe196d57ce4dd19b5a8db1c728d
|
[
"MIT"
] | 2
|
2022-01-24T06:13:03.000Z
|
2022-01-24T08:33:41.000Z
|
# credo:disable-for-this-file
defmodule(ExAliyunOts.TableStoreSearch.MatchQuery) do
@moduledoc false
(
defstruct(field_name: nil, text: nil, minimum_should_match: nil, operator: nil)
(
(
@spec encode(struct) :: {:ok, iodata} | {:error, any}
def(encode(msg)) do
try do
{:ok, encode!(msg)}
rescue
e in [Protox.EncodingError, Protox.RequiredFieldsError] ->
{:error, e}
end
end
@spec encode!(struct) :: iodata | no_return
def(encode!(msg)) do
[]
|> encode_field_name(msg)
|> encode_text(msg)
|> encode_minimum_should_match(msg)
|> encode_operator(msg)
end
)
[]
[
defp(encode_field_name(acc, msg)) do
try do
case(msg.field_name) do
nil ->
acc
_ ->
[acc, "\n", Protox.Encode.encode_string(msg.field_name)]
end
rescue
ArgumentError ->
reraise(
Protox.EncodingError.new(:field_name, "invalid field value"),
__STACKTRACE__
)
end
end,
defp(encode_text(acc, msg)) do
try do
case(msg.text) do
nil ->
acc
_ ->
[acc, <<18>>, Protox.Encode.encode_string(msg.text)]
end
rescue
ArgumentError ->
reraise(Protox.EncodingError.new(:text, "invalid field value"), __STACKTRACE__)
end
end,
defp(encode_minimum_should_match(acc, msg)) do
try do
case(msg.minimum_should_match) do
nil ->
acc
_ ->
[acc, <<24>>, Protox.Encode.encode_int32(msg.minimum_should_match)]
end
rescue
ArgumentError ->
reraise(
Protox.EncodingError.new(:minimum_should_match, "invalid field value"),
__STACKTRACE__
)
end
end,
defp(encode_operator(acc, msg)) do
try do
case(msg.operator) do
nil ->
acc
_ ->
[
acc,
" ",
msg.operator
|> ExAliyunOts.TableStoreSearch.QueryOperator.encode()
|> Protox.Encode.encode_enum()
]
end
rescue
ArgumentError ->
reraise(Protox.EncodingError.new(:operator, "invalid field value"), __STACKTRACE__)
end
end
]
[]
)
(
(
@spec decode(binary) :: {:ok, struct} | {:error, any}
def(decode(bytes)) do
try do
{:ok, decode!(bytes)}
rescue
e in [Protox.DecodingError, Protox.IllegalTagError, Protox.RequiredFieldsError] ->
{:error, e}
end
end
(
@spec decode!(binary) :: struct | no_return
def(decode!(bytes)) do
parse_key_value(bytes, struct(ExAliyunOts.TableStoreSearch.MatchQuery))
end
)
)
(
@spec parse_key_value(binary, struct) :: struct
defp(parse_key_value(<<>>, msg)) do
msg
end
defp(parse_key_value(bytes, msg)) do
{field, rest} =
case(Protox.Decode.parse_key(bytes)) do
{0, _, _} ->
raise(%Protox.IllegalTagError{})
{1, _, bytes} ->
{len, bytes} = Protox.Varint.decode(bytes)
{delimited, rest} = Protox.Decode.parse_delimited(bytes, len)
{[field_name: delimited], rest}
{2, _, bytes} ->
{len, bytes} = Protox.Varint.decode(bytes)
{delimited, rest} = Protox.Decode.parse_delimited(bytes, len)
{[text: delimited], rest}
{3, _, bytes} ->
{value, rest} = Protox.Decode.parse_int32(bytes)
{[minimum_should_match: value], rest}
{4, _, bytes} ->
{value, rest} =
Protox.Decode.parse_enum(bytes, ExAliyunOts.TableStoreSearch.QueryOperator)
{[operator: value], rest}
{tag, wire_type, rest} ->
{_, rest} = Protox.Decode.parse_unknown(tag, wire_type, rest)
{[], rest}
end
msg_updated = struct(msg, field)
parse_key_value(rest, msg_updated)
end
)
[]
)
(
@spec json_decode(iodata(), keyword()) :: {:ok, struct()} | {:error, any()}
def(json_decode(input, opts \\ [])) do
try do
{:ok, json_decode!(input, opts)}
rescue
e in Protox.JsonDecodingError ->
{:error, e}
end
end
@spec json_decode!(iodata(), keyword()) :: struct() | no_return()
def(json_decode!(input, opts \\ [])) do
{json_library_wrapper, json_library} = Protox.JsonLibrary.get_library(opts, :decode)
Protox.JsonDecode.decode!(
input,
ExAliyunOts.TableStoreSearch.MatchQuery,
&json_library_wrapper.decode!(json_library, &1)
)
end
@spec json_encode(struct(), keyword()) :: {:ok, iodata()} | {:error, any()}
def(json_encode(msg, opts \\ [])) do
try do
{:ok, json_encode!(msg, opts)}
rescue
e in Protox.JsonEncodingError ->
{:error, e}
end
end
@spec json_encode!(struct(), keyword()) :: iodata() | no_return()
def(json_encode!(msg, opts \\ [])) do
{json_library_wrapper, json_library} = Protox.JsonLibrary.get_library(opts, :encode)
Protox.JsonEncode.encode!(msg, &json_library_wrapper.encode!(json_library, &1))
end
)
@deprecated "Use fields_defs()/0 instead"
@spec defs() :: %{
required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}
}
def(defs()) do
%{
1 => {:field_name, {:scalar, ""}, :string},
2 => {:text, {:scalar, ""}, :string},
3 => {:minimum_should_match, {:scalar, 0}, :int32},
4 => {:operator, {:scalar, :OR}, {:enum, ExAliyunOts.TableStoreSearch.QueryOperator}}
}
end
@deprecated "Use fields_defs()/0 instead"
@spec defs_by_name() :: %{
required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}
}
def(defs_by_name()) do
%{
field_name: {1, {:scalar, ""}, :string},
minimum_should_match: {3, {:scalar, 0}, :int32},
operator: {4, {:scalar, :OR}, {:enum, ExAliyunOts.TableStoreSearch.QueryOperator}},
text: {2, {:scalar, ""}, :string}
}
end
@spec fields_defs() :: list(Protox.Field.t())
def(fields_defs()) do
[
%{
__struct__: Protox.Field,
json_name: "fieldName",
kind: {:scalar, ""},
label: :optional,
name: :field_name,
tag: 1,
type: :string
},
%{
__struct__: Protox.Field,
json_name: "text",
kind: {:scalar, ""},
label: :optional,
name: :text,
tag: 2,
type: :string
},
%{
__struct__: Protox.Field,
json_name: "minimumShouldMatch",
kind: {:scalar, 0},
label: :optional,
name: :minimum_should_match,
tag: 3,
type: :int32
},
%{
__struct__: Protox.Field,
json_name: "operator",
kind: {:scalar, :OR},
label: :optional,
name: :operator,
tag: 4,
type: {:enum, ExAliyunOts.TableStoreSearch.QueryOperator}
}
]
end
[
@spec(field_def(atom) :: {:ok, Protox.Field.t()} | {:error, :no_such_field}),
(
def(field_def(:field_name)) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "fieldName",
kind: {:scalar, ""},
label: :optional,
name: :field_name,
tag: 1,
type: :string
}}
end
def(field_def("fieldName")) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "fieldName",
kind: {:scalar, ""},
label: :optional,
name: :field_name,
tag: 1,
type: :string
}}
end
def(field_def("field_name")) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "fieldName",
kind: {:scalar, ""},
label: :optional,
name: :field_name,
tag: 1,
type: :string
}}
end
),
(
def(field_def(:text)) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "text",
kind: {:scalar, ""},
label: :optional,
name: :text,
tag: 2,
type: :string
}}
end
def(field_def("text")) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "text",
kind: {:scalar, ""},
label: :optional,
name: :text,
tag: 2,
type: :string
}}
end
[]
),
(
def(field_def(:minimum_should_match)) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "minimumShouldMatch",
kind: {:scalar, 0},
label: :optional,
name: :minimum_should_match,
tag: 3,
type: :int32
}}
end
def(field_def("minimumShouldMatch")) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "minimumShouldMatch",
kind: {:scalar, 0},
label: :optional,
name: :minimum_should_match,
tag: 3,
type: :int32
}}
end
def(field_def("minimum_should_match")) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "minimumShouldMatch",
kind: {:scalar, 0},
label: :optional,
name: :minimum_should_match,
tag: 3,
type: :int32
}}
end
),
(
def(field_def(:operator)) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "operator",
kind: {:scalar, :OR},
label: :optional,
name: :operator,
tag: 4,
type: {:enum, ExAliyunOts.TableStoreSearch.QueryOperator}
}}
end
def(field_def("operator")) do
{:ok,
%{
__struct__: Protox.Field,
json_name: "operator",
kind: {:scalar, :OR},
label: :optional,
name: :operator,
tag: 4,
type: {:enum, ExAliyunOts.TableStoreSearch.QueryOperator}
}}
end
[]
),
def(field_def(_)) do
{:error, :no_such_field}
end
]
[]
@spec required_fields() :: []
def(required_fields()) do
[]
end
@spec syntax() :: atom
def(syntax()) do
:proto2
end
[
@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}),
def(default(:field_name)) do
{:ok, ""}
end,
def(default(:text)) do
{:ok, ""}
end,
def(default(:minimum_should_match)) do
{:ok, 0}
end,
def(default(:operator)) do
{:ok, :OR}
end,
def(default(_)) do
{:error, :no_such_field}
end
]
)
end
| 26.774336
| 97
| 0.45885
|
93b6d97d370d9db93449e43af5a1bdfa8343bcbe
| 1,972
|
exs
|
Elixir
|
config/prod.exs
|
phensalves/rumbl
|
4ecf962038774fa81c83f07b81f36266f86effaf
|
[
"MIT"
] | 1
|
2016-09-19T01:31:35.000Z
|
2016-09-19T01:31:35.000Z
|
config/prod.exs
|
phensalves/rumbl
|
4ecf962038774fa81c83f07b81f36266f86effaf
|
[
"MIT"
] | null | null | null |
config/prod.exs
|
phensalves/rumbl
|
4ecf962038774fa81c83f07b81f36266f86effaf
|
[
"MIT"
] | null | null | null |
use Mix.Config
# For production, we configure the host to read the PORT
# from the system environment. Therefore, you will need
# to set PORT=80 before running your server.
#
# You should also configure the url host to something
# meaningful, we use this information when generating URLs.
#
# Finally, we also include the path to a manifest
# containing the digested version of static files. This
# manifest is generated by the mix phoenix.digest task
# which you typically run after static files are built.
config :rumbl, Rumbl.Endpoint,
http: [port: {:system, "PORT"}],
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/manifest.json"
# Do not print debug messages in production
config :logger, level: :info
# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :rumbl, Rumbl.Endpoint,
# ...
# url: [host: "example.com", port: 443],
# https: [port: 443,
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")]
#
# Where those two env variables return an absolute path to
# the key and cert in disk or a relative path inside priv,
# for example "priv/ssl/server.key".
#
# We also recommend setting `force_ssl`, ensuring no data is
# ever sent via http, always redirecting to https:
#
# config :rumbl, Rumbl.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
# ## Using releases
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start the server for all endpoints:
#
# config :phoenix, :serve_endpoints, true
#
# Alternatively, you can configure exactly which server to
# start per endpoint:
#
# config :rumbl, Rumbl.Endpoint, server: true
#
# Finally import the config/prod.secret.exs
# which should be versioned separately.
import_config "prod.secret.exs"
| 31.806452
| 67
| 0.710953
|
93b6e830ac92343d04bdb4dd9952ce2434a7807f
| 319
|
exs
|
Elixir
|
priv/repo/migrations/20201023163530_add_user_workspace.exs
|
sealas/sealax
|
3f11b7f649972a43f4812ea959bd2be2e0151baa
|
[
"MIT"
] | null | null | null |
priv/repo/migrations/20201023163530_add_user_workspace.exs
|
sealas/sealax
|
3f11b7f649972a43f4812ea959bd2be2e0151baa
|
[
"MIT"
] | 9
|
2021-08-19T01:09:55.000Z
|
2022-03-08T01:18:45.000Z
|
priv/repo/migrations/20201023163530_add_user_workspace.exs
|
sealas/sealax
|
3f11b7f649972a43f4812ea959bd2be2e0151baa
|
[
"MIT"
] | null | null | null |
defmodule Sealax.Repo.Migrations.AddUserWorkspace do
use Ecto.Migration
def change do
create table(:user_workspaces) do
add :appkey, :string
add :appkey_salt, :string
add :user_id, references(:user)
add :workspace_id, references(:workspaces)
timestamps()
end
end
end
| 19.9375
| 52
| 0.673981
|
93b71e60b2cc043dfc7ac41d652e232d8e505c89
| 1,970
|
ex
|
Elixir
|
lib/elastic/role.ex
|
flexibility-org/elastic
|
c9d6e3c514e7a1f4958e2ba462c189829e3e5660
|
[
"MIT"
] | null | null | null |
lib/elastic/role.ex
|
flexibility-org/elastic
|
c9d6e3c514e7a1f4958e2ba462c189829e3e5660
|
[
"MIT"
] | 1
|
2021-10-18T11:43:13.000Z
|
2021-10-19T07:34:57.000Z
|
lib/elastic/role.ex
|
flexibility-org/elastic
|
c9d6e3c514e7a1f4958e2ba462c189829e3e5660
|
[
"MIT"
] | null | null | null |
defmodule Elastic.Role do
@moduledoc """
An API wrapper for dealing with ElasticSearch roles.
In particular, this wrapper covers the following elements of the
[ElasticSearch REST API](https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html):
* [Create or update roles API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html)
* [Get roles API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html)
* [Delete roles API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html)
"""
alias Elastic.HTTP
alias Elastic.ResponseHandler
alias Elastic.User.Name
@base_url Elastic.base_url() <> "/_security/role/"
@spec upsert(
name :: binary(),
body :: map()
) :: ResponseHandler.upsert_result()
def upsert(name, body) do
response =
HTTP.put(@base_url <> Name.url_encode(name),
body: body
)
case response do
{:ok, 200, %{"role" => %{"created" => true}}} ->
{:ok, :created}
{:ok, 200, %{"role" => %{"created" => false}}} ->
{:ok, :updated}
{_, status_code, data} ->
{:error, {:unknown_response, {status_code, data}}}
end
end
@spec delete(name :: binary()) :: ResponseHandler.find_result()
def delete(name) do
HTTP.delete(@base_url <> Name.url_encode(name))
|> ResponseHandler.process_find_response()
end
@spec get(name :: binary() | nil) :: {:ok, map()} | ResponseHandler.find_error()
def get(name \\ nil) do
url =
case name do
nil -> ""
_ -> Name.url_encode(name)
end
response = HTTP.get(@base_url <> url)
case response do
{:ok, 200, roles} ->
{:ok, roles}
{:error, 404, %{}} ->
{:error, :not_found}
{_, status_code, data} ->
{:error, {:unknown_response, {status_code, data}}}
end
end
end
| 28.550725
| 124
| 0.619797
|
93b72076d4e9819c7af560b08ce7da66638396c6
| 2,154
|
exs
|
Elixir
|
config/dev.exs
|
franknfjr/dashboard
|
68ff963d4cd51b1b3d92373e84b606fccedb7d89
|
[
"MIT"
] | 1
|
2021-01-27T17:44:38.000Z
|
2021-01-27T17:44:38.000Z
|
config/dev.exs
|
franknfjr/dashboard
|
68ff963d4cd51b1b3d92373e84b606fccedb7d89
|
[
"MIT"
] | null | null | null |
config/dev.exs
|
franknfjr/dashboard
|
68ff963d4cd51b1b3d92373e84b606fccedb7d89
|
[
"MIT"
] | null | null | null |
use Mix.Config
# Configure your database
config :dashboard, Dashboard.Repo,
username: "postgres",
password: "postgres",
database: "dashboard_dev",
hostname: "localhost",
show_sensitive_data_on_connection_error: true,
pool_size: 10
# 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 webpack to recompile .js and .css sources.
config :dashboard, DashboardWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../assets", __DIR__)
]
]
# ## SSL Support
#
# In order to use HTTPS in development, a self-signed
# certificate can be generated by running the following
# Mix task:
#
# mix phx.gen.cert
#
# Note that this task requires Erlang/OTP 20 or later.
# Run `mix help phx.gen.cert` for more information.
#
# The `http:` config above can be replaced with:
#
# https: [
# port: 4001,
# cipher_suite: :strong,
# keyfile: "priv/cert/selfsigned_key.pem",
# certfile: "priv/cert/selfsigned.pem"
# ],
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.
# Watch static and templates for browser reloading.
config :dashboard, DashboardWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/dashboard_web/(live|views)/.*(ex)$",
~r"lib/dashboard_web/templates/.*(eex)$"
]
]
# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20
# Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime
| 27.974026
| 68
| 0.693129
|
93b735e338ad153db602b923d6668b1c7b3c3e57
| 4,947
|
ex
|
Elixir
|
lib/canvas/client.ex
|
acu-online/canvas
|
594e435abe8907097a3a66d25627e96cb940b07a
|
[
"MIT"
] | null | null | null |
lib/canvas/client.ex
|
acu-online/canvas
|
594e435abe8907097a3a66d25627e96cb940b07a
|
[
"MIT"
] | null | null | null |
lib/canvas/client.ex
|
acu-online/canvas
|
594e435abe8907097a3a66d25627e96cb940b07a
|
[
"MIT"
] | null | null | null |
defmodule Canvas.Client do
require Logger
@default_base_url Application.get_env(:canvas, :base_url)
@default_user_agent "canvas-elixir/#{Application.get_env(:canvas, :version)}"
@api_version "v1"
defstruct access_token: nil, base_url: @default_base_url, user_agent: nil
@type t :: %__MODULE__{access_token: String.t(), base_url: String.t(), user_agent: String.t()}
@type headers :: [{binary, binary}] | %{binary => binary}
@type body :: binary | {:form, [{atom, any}]} | {:file, binary}
@doc """
Prepends the correct API version to path.
## Examples
iex> Canvas.Client.versioned "/accounts"
"/api/v1/accounts"
"""
@spec versioned(String.t()) :: String.t()
def versioned(path) do
"/api/" <> @api_version <> path
end
@doc """
Returns the representation of an empty body in a request.
## Examples
iex> Canvas.Client.empty_body()
nil
"""
@spec empty_body :: nil
def empty_body, do: nil
@doc """
Issues a GET request to the given url.
"""
@spec get(Client.t(), binary, Keyword.t()) ::
{:ok | :error, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()}
def get(client, url, options \\ []), do: execute(client, :get, url, empty_body(), options)
@doc """
Issues a POST request to the given url.
"""
@spec post(Client.t(), binary, body, Keyword.t()) ::
{:ok | :error, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()}
def post(client, url, body, options \\ []), do: execute(client, :post, url, body, options)
@doc """
Issues a PUT request to the given url.
"""
@spec put(Client.t(), binary, body, Keyword.t()) ::
{:ok | :error, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()}
def put(client, url, body, options \\ []), do: execute(client, :put, url, body, options)
@doc """
Issues a PATCH request to the given url.
"""
@spec patch(Client.t(), binary, body, Keyword.t()) ::
{:ok | :error, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()}
def patch(client, url, body, options \\ []), do: execute(client, :patch, url, body, options)
@doc """
Issues a DELETE request to the given url.
"""
@spec delete(Client.t(), binary, Keyword.t()) ::
{:ok | :error, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()}
def delete(client, url, options \\ []), do: execute(client, :delete, url, empty_body(), options)
def execute(client, method, url, body \\ "", all_options \\ []) do
{headers, options} = split_headers_options(client, all_options)
{headers, body} = process_request_body(headers, body)
base_options = [recv_timeout: 30000]
Logger.debug("[canvas] #{format_http_method(method)} #{url(client, url)} #{inspect(options)}")
HTTPoison.request!(
method,
url(client, url),
body,
headers,
Keyword.merge(base_options, options)
)
|> check_response
end
defp split_headers_options(client, all_options) do
default_headers = %{
"Accept" => "application/json",
"User-Agent" => format_user_agent(client.user_agent),
"Authorization" => "Bearer #{client.access_token}"
}
{headers, options} = Keyword.pop(all_options, :headers)
case headers do
nil -> {default_headers, options}
headers -> {Enum.into(headers, default_headers), options}
end
end
# Builds the final user agent to use for HTTP requests.
#
# If no custom user agent is provided, the default user agent is used.
#
# canvas-elixir/0.0.1
#
# If a custom user agent is provided, the final user agent is the combination
# of the custom user agent prepended by the default user agent.
#
# canvas-elixir/0.0.1 customAgentFlag
#
defp format_user_agent(nil), do: @default_user_agent
defp format_user_agent(custom_agent) do
"#{@default_user_agent} #{custom_agent}"
end
# Extracts a specific {"Name", "Value"} header tuple.
defp get_header(headers, name) do
Enum.find(headers, fn {key, _} -> key == name end)
end
defp process_request_body(headers, nil), do: {headers, []}
defp process_request_body(headers, body) when is_binary(body), do: {headers, body}
defp process_request_body(headers, body) do
case get_header(headers, "Accept") do
{_, "application/json"} ->
{Map.put(headers, "Content-Type", "application/json"), Poison.encode!(body)}
_ ->
{headers, body}
end
end
defp url(%Canvas.Client{base_url: base_url}, path) do
base_url <> path
end
defp check_response(http_response) do
case http_response.status_code do
i when i in 200..299 -> {:ok, http_response}
404 -> {:error, Canvas.NotFoundError.new(http_response)}
_ -> {:error, Canvas.RequestError.new(http_response)}
end
end
defp format_http_method(method) when is_atom(method),
do: format_http_method(Atom.to_string(method))
defp format_http_method(method) when is_binary(method), do: String.upcase(method)
end
| 31.113208
| 98
| 0.654538
|
93b76c93602f4bb90b25e6227d545192de627dbd
| 223
|
exs
|
Elixir
|
priv/repo/migrations/20210311150141_add_rider_spreadsheet_layout_to_campaigns.exs
|
bikebrigade/dispatch
|
eb622fe4f6dab7c917d678d3d7a322a01f97da44
|
[
"Apache-2.0"
] | 28
|
2021-10-11T01:53:53.000Z
|
2022-03-24T17:45:55.000Z
|
priv/repo/migrations/20210311150141_add_rider_spreadsheet_layout_to_campaigns.exs
|
bikebrigade/dispatch
|
eb622fe4f6dab7c917d678d3d7a322a01f97da44
|
[
"Apache-2.0"
] | 20
|
2021-10-21T08:12:31.000Z
|
2022-03-31T13:35:53.000Z
|
priv/repo/migrations/20210311150141_add_rider_spreadsheet_layout_to_campaigns.exs
|
bikebrigade/dispatch
|
eb622fe4f6dab7c917d678d3d7a322a01f97da44
|
[
"Apache-2.0"
] | null | null | null |
defmodule BikeBrigade.Repo.Migrations.AddRiderSpreadsheetLayoutToCampaigns do
use Ecto.Migration
def change do
alter table(:campaigns) do
add :rider_spreadsheet_layout, :integer, default: 0
end
end
end
| 22.3
| 77
| 0.766816
|
93b781704f9d7fc1d8df528a7b6242908f8a7435
| 770
|
exs
|
Elixir
|
test/changelog/icecast_test.exs
|
d-m-u/changelog.com
|
bb0d6ac6d29a3d64dbeb44892f9a8a1ff3ba6325
|
[
"MIT"
] | 1
|
2021-01-06T18:21:45.000Z
|
2021-01-06T18:21:45.000Z
|
test/changelog/icecast_test.exs
|
codexn/changelog.com
|
25ce501ee62eef76731c38d590667e8132096ba8
|
[
"MIT"
] | null | null | null |
test/changelog/icecast_test.exs
|
codexn/changelog.com
|
25ce501ee62eef76731c38d590667e8132096ba8
|
[
"MIT"
] | null | null | null |
defmodule Changelog.IcecastTest do
use ExUnit.Case
import Mock
alias Changelog.Icecast
describe "get_stats" do
test "is not streaming on decode error" do
with_mock(HTTPoison, get!: fn _ -> %{status_code: 200, body: ""} end) do
stats = Icecast.get_stats()
assert called(HTTPoison.get!(:_))
refute stats.streaming
end
end
test "is streaming with listeners when appropriate" do
body = %{"icestats" => %{"source" => %{"listeners" => 3}}}
with_mock(HTTPoison, get!: fn _ -> %{status_code: 200, body: Jason.encode!(body)} end) do
stats = Icecast.get_stats()
assert called(HTTPoison.get!(:_))
assert stats.streaming
assert stats.listeners == 3
end
end
end
end
| 26.551724
| 95
| 0.623377
|
93b79084f048720509448c0833b4a2d3d9011ff1
| 6,823
|
exs
|
Elixir
|
apps/admin_api/test/admin_api/v1/controllers/admin_auth/transaction_calculation_controller_test.exs
|
vanmil/ewallet
|
6c1aca95a83e0a9d93007670a40d8c45764a8122
|
[
"Apache-2.0"
] | null | null | null |
apps/admin_api/test/admin_api/v1/controllers/admin_auth/transaction_calculation_controller_test.exs
|
vanmil/ewallet
|
6c1aca95a83e0a9d93007670a40d8c45764a8122
|
[
"Apache-2.0"
] | null | null | null |
apps/admin_api/test/admin_api/v1/controllers/admin_auth/transaction_calculation_controller_test.exs
|
vanmil/ewallet
|
6c1aca95a83e0a9d93007670a40d8c45764a8122
|
[
"Apache-2.0"
] | null | null | null |
defmodule AdminAPI.V1.AdminAuth.TransactionCalculationControllerTest do
use AdminAPI.ConnCase, async: true
# credo:disable-for-next-line
setup do
eth = insert(:token)
omg = insert(:token)
pair = insert(:exchange_pair, from_token: eth, to_token: omg, rate: 10)
%{
eth: eth,
omg: omg,
pair: pair
}
end
describe "/transaction.calculate" do
test "returns the calculation when all params are provided", context do
response =
admin_user_request("/transaction.calculate", %{
"from_amount" => 100,
"from_token_id" => context.eth.id,
"to_amount" => 100 * context.pair.rate,
"to_token_id" => context.omg.id
})
assert response["success"] == true
assert response["data"]["object"] == "transaction_calculation"
assert response["data"]["from_amount"] == 100
assert response["data"]["from_token_id"] == context.eth.id
assert response["data"]["to_amount"] == 100 * context.pair.rate
assert response["data"]["to_token_id"] == context.omg.id
assert response["data"]["calculated_at"] != nil
assert response["data"]["exchange_pair"]["object"] == "exchange_pair"
assert response["data"]["exchange_pair"]["id"] == context.pair.id
end
test "accepts integer strings", context do
response =
admin_user_request("/transaction.calculate", %{
"from_amount" => "100",
"from_token_id" => context.eth.id,
"to_amount" => "1000",
"to_token_id" => context.omg.id
})
assert response["success"] == true
assert response["data"]["object"] == "transaction_calculation"
assert response["data"]["from_amount"] == 100
assert response["data"]["from_token_id"] == context.eth.id
assert response["data"]["to_amount"] == 100 * context.pair.rate
assert response["data"]["to_token_id"] == context.omg.id
end
test "returns the calculation when `from_amount` is left out", context do
response =
admin_user_request("/transaction.calculate", %{
# "from_amount" => 200 / context.pair.rate,
"from_token_id" => context.eth.id,
"to_amount" => 200,
"to_token_id" => context.omg.id
})
assert response["success"] == true
assert response["data"]["object"] == "transaction_calculation"
assert response["data"]["from_amount"] == 200 / context.pair.rate
assert response["data"]["from_token_id"] == context.eth.id
assert response["data"]["to_amount"] == 200
assert response["data"]["to_token_id"] == context.omg.id
assert response["data"]["calculated_at"] != nil
assert response["data"]["exchange_pair"]["object"] == "exchange_pair"
assert response["data"]["exchange_pair"]["id"] == context.pair.id
end
test "returns the calculation when `to_amount` is left out", context do
response =
admin_user_request("/transaction.calculate", %{
"from_amount" => 300,
"from_token_id" => context.eth.id,
# "to_amount" => 300 * context.pair.rate,
"to_token_id" => context.omg.id
})
assert response["success"] == true
assert response["data"]["object"] == "transaction_calculation"
assert response["data"]["from_amount"] == 300
assert response["data"]["from_token_id"] == context.eth.id
assert response["data"]["to_amount"] == 300 * context.pair.rate
assert response["data"]["to_token_id"] == context.omg.id
assert response["data"]["calculated_at"] != nil
assert response["data"]["exchange_pair"]["object"] == "exchange_pair"
assert response["data"]["exchange_pair"]["id"] == context.pair.id
end
test "returns an error when the amounts conflict with the available exchange pair", context do
response =
admin_user_request("/transaction.calculate", %{
"from_amount" => 100,
"from_token_id" => context.eth.id,
"to_amount" => 999_999,
"to_token_id" => context.omg.id
})
assert response["success"] == false
assert response["data"]["object"] == "error"
assert response["data"]["code"] == "exchange:invalid_rate"
assert response["data"]["description"] ==
"expected 'from_amount' to be 100 and 'to_amount' to be 1000, got 100 and 999999"
end
test "returns an error when `from_token_id` is missing", context do
response =
admin_user_request("/transaction.calculate", %{
"from_amount" => 100,
# "from_token_id" => context.eth.id,
"to_amount" => 100 * context.pair.rate,
"to_token_id" => context.omg.id
})
assert response["success"] == false
assert response["data"]["object"] == "error"
assert response["data"]["code"] == "client:invalid_parameter"
assert response["data"]["description"] == "`from_token_id` is required"
end
test "returns an error when `to_token_id` is missing", context do
response =
admin_user_request("/transaction.calculate", %{
"from_amount" => 100,
"from_token_id" => context.eth.id,
"to_amount" => 100 * context.pair.rate
# "to_token_id" => context.omg.id
})
assert response["success"] == false
assert response["data"]["object"] == "error"
assert response["data"]["code"] == "client:invalid_parameter"
assert response["data"]["description"] == "`to_token_id` is required"
end
test "returns an error when both `from_token_id` and `to_token_id` are missing", context do
response =
admin_user_request("/transaction.calculate", %{
"from_amount" => 100,
# "from_token_id" => context.eth.id,
"to_amount" => 100 * context.pair.rate
# "to_token_id" => context.omg.id
})
assert response["success"] == false
assert response["data"]["object"] == "error"
assert response["data"]["code"] == "client:invalid_parameter"
assert response["data"]["description"] ==
"both `from_token_id` and `to_token_id` are required"
end
test "returns an error when both `from_amount` and `to_amount` are missing", context do
response =
admin_user_request("/transaction.calculate", %{
# "from_amount" => 100,
"from_token_id" => context.eth.id,
# "to_amount" => 100 * context.pair.rate
"to_token_id" => context.omg.id
})
assert response["success"] == false
assert response["data"]["object"] == "error"
assert response["data"]["code"] == "client:invalid_parameter"
assert response["data"]["description"] == "either `from_amount` or `to_amount` is required"
end
end
end
| 37.489011
| 98
| 0.609263
|
93b793429854804a7e61fa538a95926862fd5caf
| 1,038
|
exs
|
Elixir
|
mix.exs
|
bonfire-networks/linkify
|
76a4026f73a4593e0ec664d99220bb4e5dea6e34
|
[
"MIT"
] | 1
|
2021-04-07T01:30:03.000Z
|
2021-04-07T01:30:03.000Z
|
mix.exs
|
bonfire-networks/linkify
|
76a4026f73a4593e0ec664d99220bb4e5dea6e34
|
[
"MIT"
] | null | null | null |
mix.exs
|
bonfire-networks/linkify
|
76a4026f73a4593e0ec664d99220bb4e5dea6e34
|
[
"MIT"
] | null | null | null |
defmodule Linkify.Mixfile do
use Mix.Project
@version "0.2.0"
def project do
[
app: :linkify,
version: @version,
elixir: "~> 1.8",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: [extras: ["README.md"]],
package: package(),
name: "Linkify",
description: """
Linkify is a basic package for turning website names into links.
"""
]
end
# Configuration for the OTP application
def application do
# Specify extra applications you'll use from Erlang/Elixir
[extra_applications: [:logger]]
end
# Dependencies can be Hex packages:
defp deps do
[
{:ex_doc, "~> 0.20", only: :dev, runtime: false},
{:credo, "~> 1.4.0", only: [:dev, :test], runtime: false}
]
end
defp package do
[
licenses: ["MIT"],
links: %{"GitLab" => "https://git.pleroma.social/pleroma/elixir-libraries/linkify"},
files: ~w(lib priv README.md mix.exs LICENSE)
]
end
end
| 23.066667
| 90
| 0.585742
|
93b7a2d32036a2865bfb46c9e9e5f0b98cb33ad9
| 474
|
ex
|
Elixir
|
apps/fz_http/lib/fz_http_web/views/user_view.ex
|
kaku-io/firezone
|
685da0064727df27e444fe4da2be20efe96af9cd
|
[
"Apache-2.0"
] | 1,429
|
2021-07-31T21:25:46.000Z
|
2022-03-31T16:31:33.000Z
|
apps/fz_http/lib/fz_http_web/views/user_view.ex
|
kaku-io/firezone
|
685da0064727df27e444fe4da2be20efe96af9cd
|
[
"Apache-2.0"
] | 132
|
2021-07-10T14:23:36.000Z
|
2022-03-29T18:36:37.000Z
|
apps/fz_http/lib/fz_http_web/views/user_view.ex
|
CloudFire-LLC/cloudfire
|
24ea29bda8a8845a0a9c3b0482cc67e314611245
|
[
"Apache-2.0"
] | 48
|
2021-09-14T02:48:38.000Z
|
2022-03-24T18:18:50.000Z
|
defmodule FzHttpWeb.UserView do
@moduledoc """
Helper functions for User views.
"""
use FzHttpWeb, :view
alias FzHttp.{Settings, Users}
def admin_email do
Users.admin().email
end
def vpn_sessions_expire? do
Settings.vpn_sessions_expire?()
end
def vpn_expires_at(user) do
Users.vpn_session_expires_at(user, Settings.vpn_duration())
end
def vpn_expired?(user) do
Users.vpn_session_expired?(user, Settings.vpn_duration())
end
end
| 18.96
| 63
| 0.723629
|
93b7cc5e3d00012b08e8dfd0b83ddf38753c6f4c
| 92
|
exs
|
Elixir
|
config/config.exs
|
kingdomcoding/tailwind
|
0bc48d3b0cf433ad38894ff2eef78dab563640ba
|
[
"MIT"
] | 311
|
2021-12-20T22:11:07.000Z
|
2022-03-31T16:03:30.000Z
|
config/config.exs
|
kingdomcoding/tailwind
|
0bc48d3b0cf433ad38894ff2eef78dab563640ba
|
[
"MIT"
] | 32
|
2021-12-21T05:21:57.000Z
|
2022-03-30T13:04:20.000Z
|
config/config.exs
|
kingdomcoding/tailwind
|
0bc48d3b0cf433ad38894ff2eef78dab563640ba
|
[
"MIT"
] | 26
|
2021-12-21T18:49:48.000Z
|
2022-03-16T12:53:32.000Z
|
import Config
config :tailwind,
version: "3.0.12",
another: [
args: ["--help"]
]
| 11.5
| 20
| 0.565217
|
93b836a8214dc675c3e16283a74b3d7db71cc4a1
| 234
|
exs
|
Elixir
|
test/money_changeset_test.exs
|
seantanly/money_sql
|
4511d05c55a9e953c2652ff777f17053d0cdce47
|
[
"Apache-2.0"
] | null | null | null |
test/money_changeset_test.exs
|
seantanly/money_sql
|
4511d05c55a9e953c2652ff777f17053d0cdce47
|
[
"Apache-2.0"
] | null | null | null |
test/money_changeset_test.exs
|
seantanly/money_sql
|
4511d05c55a9e953c2652ff777f17053d0cdce47
|
[
"Apache-2.0"
] | null | null | null |
defmodule Money.Changeset.Test do
use ExUnit.Case
test "Changeset default currency" do
changeset = Organization.changeset(%Organization{}, %{payroll: "0"})
assert changeset.changes.payroll == Money.new(:JPY, 0)
end
end
| 26
| 72
| 0.722222
|
93b851ae7e1c9a781d793f3ddcaa2ed0f3a858c9
| 2,623
|
ex
|
Elixir
|
clients/big_query/lib/google_api/big_query/v2/model/job_statistics.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | null | null | null |
clients/big_query/lib/google_api/big_query/v2/model/job_statistics.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | null | null | null |
clients/big_query/lib/google_api/big_query/v2/model/job_statistics.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | 1
|
2018-07-28T20:50:50.000Z
|
2018-07-28T20:50:50.000Z
|
# 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.BigQuery.V2.Model.JobStatistics do
@moduledoc """
## Attributes
- creationTime (String.t): [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs. Defaults to: `null`.
- endTime (String.t): [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state. Defaults to: `null`.
- extract (JobStatistics4): [Output-only] Statistics for an extract job. Defaults to: `null`.
- load (JobStatistics3): [Output-only] Statistics for a load job. Defaults to: `null`.
- query (JobStatistics2): [Output-only] Statistics for a query job. Defaults to: `null`.
- startTime (String.t): [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE. Defaults to: `null`.
- totalBytesProcessed (String.t): [Output-only] [Deprecated] Use the bytes processed in the query statistics instead. Defaults to: `null`.
"""
defstruct [
:"creationTime",
:"endTime",
:"extract",
:"load",
:"query",
:"startTime",
:"totalBytesProcessed"
]
end
defimpl Poison.Decoder, for: GoogleApi.BigQuery.V2.Model.JobStatistics do
import GoogleApi.BigQuery.V2.Deserializer
def decode(value, options) do
value
|> deserialize(:"extract", :struct, GoogleApi.BigQuery.V2.Model.JobStatistics4, options)
|> deserialize(:"load", :struct, GoogleApi.BigQuery.V2.Model.JobStatistics3, options)
|> deserialize(:"query", :struct, GoogleApi.BigQuery.V2.Model.JobStatistics2, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.BigQuery.V2.Model.JobStatistics do
def encode(value, options) do
GoogleApi.BigQuery.V2.Deserializer.serialize_non_nil(value, options)
end
end
| 42.306452
| 219
| 0.737324
|
93b861709bb25d48130347a96614ba28cc298ab9
| 452
|
ex
|
Elixir
|
backend/web/helpers/session.ex
|
hploscar/palike
|
71618593ee6e6687e0d1cdc9e923ed8f9c2cc2cb
|
[
"MIT"
] | null | null | null |
backend/web/helpers/session.ex
|
hploscar/palike
|
71618593ee6e6687e0d1cdc9e923ed8f9c2cc2cb
|
[
"MIT"
] | null | null | null |
backend/web/helpers/session.ex
|
hploscar/palike
|
71618593ee6e6687e0d1cdc9e923ed8f9c2cc2cb
|
[
"MIT"
] | null | null | null |
defmodule Palike.Session do
alias Palike.{Repo, User}
def authenticate(%{"email" => email, "password" => password}) do
user = Repo.get_by(User, email: String.downcase(email))
case check_password(user, password) do
true -> {:ok, user}
_ -> :error
end
end
defp check_password(user, password) do
case user do
nil -> false
_ -> Comeonin.Bcrypt.checkpw(password, user.encrypted_password)
end
end
end
| 22.6
| 69
| 0.64823
|
93b869c7a4dd20310c98068694d762c50874e46a
| 281
|
ex
|
Elixir
|
lib/nautilus/ports/message/message_action_port.ex
|
CarloHFR/NautilusGateway
|
26211948c5f9127e6662a90e41df5b43b2408372
|
[
"MIT"
] | null | null | null |
lib/nautilus/ports/message/message_action_port.ex
|
CarloHFR/NautilusGateway
|
26211948c5f9127e6662a90e41df5b43b2408372
|
[
"MIT"
] | null | null | null |
lib/nautilus/ports/message/message_action_port.ex
|
CarloHFR/NautilusGateway
|
26211948c5f9127e6662a90e41df5b43b2408372
|
[
"MIT"
] | null | null | null |
defmodule Nautilus.Ports.Message.MessageAction do
@moduledoc """
This module establish a behavior for message action
"""
@doc """
This function will implements message action
"""
@callback execute(pid :: pid, message :: map()) :: any
end
| 21.615385
| 59
| 0.626335
|
93b891698b4cc3266ab258dbfd51811377186e1b
| 986
|
ex
|
Elixir
|
lib/flamelex/buffer/supervision_tree/buffer_supervisor_top.ex
|
JediLuke/flamelex
|
b38d1171b8f93375d8dc59f1710442860b6c8580
|
[
"Apache-2.0"
] | 10
|
2021-03-02T20:05:13.000Z
|
2022-03-14T21:10:39.000Z
|
lib/flamelex/editor/buffer/supervision_tree/buffer_supervisor_top.ex
|
JediLuke/franklin
|
8eb77a342547de3eb43d28dcf9f835ff443ad489
|
[
"Apache-2.0"
] | 2
|
2021-12-14T18:29:44.000Z
|
2021-12-23T20:38:27.000Z
|
lib/flamelex/editor/buffer/supervision_tree/buffer_supervisor_top.ex
|
JediLuke/franklin
|
8eb77a342547de3eb43d28dcf9f835ff443ad489
|
[
"Apache-2.0"
] | 2
|
2021-12-05T20:41:26.000Z
|
2021-12-26T01:46:42.000Z
|
defmodule Flamelex.Buffer.TopLevelSupervisor do
@moduledoc """
This Supervisor monitors the Buffer.Manager and the Buffer.DynamicSupervisor
"""
use Supervisor
require Logger
def start_link(params) do
Supervisor.start_link(__MODULE__, params, name: __MODULE__)
end
def init(_params) do
Logger.debug "#{__MODULE__} initializing..."
children = [
# {Registry, keys: :unique, name: Flamelex.Buffer.ProcessRegistry},
#TODO put all these tasks supervisors, under 1 supervisors? Or, marry
# them up to one higher-up supervisor per sub-area??
{Task.Supervisor, name: Flamelex.Buffer.Reducer.TaskSupervisor},
{Task.Supervisor, name: KommandBuffer.Reducer},
Flamelex.Buffer.SeniorSupervisor,
Flamelex.BufferManager,
{Flamelex.Buffer.KommandBuffer, %{rego_tag: {:buffer, KommandBuffer}}},
# {Registry, keys: :unique, name: BufferRegistry},
]
Supervisor.init(children, strategy: :one_for_all)
end
end
| 30.8125
| 78
| 0.709939
|
93b897217a81b9c6eab859a33f6688e0165ec96d
| 1,940
|
ex
|
Elixir
|
apps/ewallet/lib/ewallet/fetchers/exchange_account_fetcher.ex
|
vanmil/ewallet
|
6c1aca95a83e0a9d93007670a40d8c45764a8122
|
[
"Apache-2.0"
] | null | null | null |
apps/ewallet/lib/ewallet/fetchers/exchange_account_fetcher.ex
|
vanmil/ewallet
|
6c1aca95a83e0a9d93007670a40d8c45764a8122
|
[
"Apache-2.0"
] | null | null | null |
apps/ewallet/lib/ewallet/fetchers/exchange_account_fetcher.ex
|
vanmil/ewallet
|
6c1aca95a83e0a9d93007670a40d8c45764a8122
|
[
"Apache-2.0"
] | null | null | null |
defmodule EWallet.ExchangeAccountFetcher do
@moduledoc """
Fetch exchange account and/or exchange wallet.
"""
alias EWallet.WalletFetcher
alias EWalletDB.{Repo, Account}
def fetch(%{
"exchange_account_id" => exchange_account_id,
"exchange_wallet_address" => exchange_wallet_address
})
when not is_nil(exchange_account_id) and not is_nil(exchange_wallet_address) do
with %Account{} = exchange_account <-
Account.get(exchange_account_id) || {:error, :exchange_account_id_not_found},
{:ok, exchange_wallet} <- WalletFetcher.get(exchange_account, exchange_wallet_address) do
{:ok, exchange_wallet}
else
{:error, :account_wallet_not_found} ->
{:error, :exchange_account_wallet_not_found}
{:error, :account_wallet_mismatch} ->
{:error, :exchange_account_wallet_mismatch}
error ->
error
end
end
def fetch(%{"exchange_account_id" => exchange_account_id})
when not is_nil(exchange_account_id) do
with %Account{} = exchange_account <-
Account.get(exchange_account_id) || {:error, :exchange_account_id_not_found},
exchange_wallet <- Account.get_primary_wallet(exchange_account) do
{:ok, exchange_wallet}
else
error ->
error
end
end
def fetch(%{
"exchange_wallet_address" => exchange_wallet_address
})
when not is_nil(exchange_wallet_address) do
with {:ok, exchange_wallet} <- WalletFetcher.get(nil, exchange_wallet_address),
exchange_wallet <- Repo.preload(exchange_wallet, [:account]),
%Account{} = _exchange_account <-
exchange_wallet.account || {:error, :exchange_address_not_account} do
{:ok, exchange_wallet}
else
{:error, :account_wallet_not_found} ->
{:error, :exchange_account_wallet_not_found}
error ->
error
end
end
def fetch(_), do: {:ok, nil}
end
| 31.803279
| 98
| 0.672165
|
93b8b85cff4d567c3c197ab379f8d5c8e7dc7628
| 451
|
exs
|
Elixir
|
test/bank_web/views/error_view_test.exs
|
rai200890/phoenix-commanded-example
|
d68b89a3aee8f1a3f27744eded2c44eddcf92a1a
|
[
"MIT"
] | null | null | null |
test/bank_web/views/error_view_test.exs
|
rai200890/phoenix-commanded-example
|
d68b89a3aee8f1a3f27744eded2c44eddcf92a1a
|
[
"MIT"
] | null | null | null |
test/bank_web/views/error_view_test.exs
|
rai200890/phoenix-commanded-example
|
d68b89a3aee8f1a3f27744eded2c44eddcf92a1a
|
[
"MIT"
] | null | null | null |
defmodule BankWeb.ErrorViewTest do
use BankWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.json" do
assert render(BankWeb.ErrorView, "404.json", []) ==
%{errors: %{detail: "Not Found"}}
end
test "renders 500.json" do
assert render(BankWeb.ErrorView, "500.json", []) ==
%{errors: %{detail: "Internal Server Error"}}
end
end
| 26.529412
| 66
| 0.660754
|
93b8bdadea45273d277f304946966f6551038230
| 4,704
|
ex
|
Elixir
|
clients/games_management/lib/google_api/games_management/v1management/api/rooms.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | null | null | null |
clients/games_management/lib/google_api/games_management/v1management/api/rooms.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | null | null | null |
clients/games_management/lib/google_api/games_management/v1management/api/rooms.ex
|
GoNZooo/elixir-google-api
|
cf3ad7392921177f68091f3d9001f1b01b92f1cc
|
[
"Apache-2.0"
] | 1
|
2018-07-28T20:50:50.000Z
|
2018-07-28T20:50:50.000Z
|
# 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.GamesManagement.V1management.Api.Rooms do
@moduledoc """
API calls for all endpoints tagged `Rooms`.
"""
alias GoogleApi.GamesManagement.V1management.Connection
import GoogleApi.GamesManagement.V1management.RequestBuilder
@doc """
Reset all rooms for the currently authenticated player for your application. This method is only accessible to whitelisted tester accounts for your application.
## Parameters
- connection (GoogleApi.GamesManagement.V1management.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :alt (String): Data format for the response.
- :fields (String): Selector specifying which fields to include in a partial response.
- :key (String): 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 (String): OAuth 2.0 token for the current user.
- :pretty_print (Boolean): Returns response with indentations and line breaks.
- :quota_user (String): 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. Overrides userIp if both are provided.
- :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec games_management_rooms_reset(Tesla.Env.client, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def games_management_rooms_reset(connection, opts \\ []) do
optional_params = %{
:"alt" => :query,
:"fields" => :query,
:"key" => :query,
:"oauth_token" => :query,
:"prettyPrint" => :query,
:"quotaUser" => :query,
:"userIp" => :query
}
%{}
|> method(:post)
|> url("/rooms/reset")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
@doc """
Deletes rooms where the only room participants are from whitelisted tester accounts for your application. This method is only available to user accounts for your developer console.
## Parameters
- connection (GoogleApi.GamesManagement.V1management.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :alt (String): Data format for the response.
- :fields (String): Selector specifying which fields to include in a partial response.
- :key (String): 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 (String): OAuth 2.0 token for the current user.
- :pretty_print (Boolean): Returns response with indentations and line breaks.
- :quota_user (String): 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. Overrides userIp if both are provided.
- :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec games_management_rooms_reset_for_all_players(Tesla.Env.client, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def games_management_rooms_reset_for_all_players(connection, opts \\ []) do
optional_params = %{
:"alt" => :query,
:"fields" => :query,
:"key" => :query,
:"oauth_token" => :query,
:"prettyPrint" => :query,
:"quotaUser" => :query,
:"userIp" => :query
}
%{}
|> method(:post)
|> url("/rooms/resetForAllPlayers")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
end
| 43.155963
| 217
| 0.703444
|
93b8c22010216f67486c663e8a466a1dda624bf3
| 823
|
ex
|
Elixir
|
test/support/edge_cases/multiple_def_cases/various.ex
|
Ajwah/ex_debugger
|
44cd5b99c0b7751db052887b7a0bc3ce52a2972e
|
[
"Apache-2.0"
] | 3
|
2020-07-07T20:41:23.000Z
|
2020-07-17T09:05:37.000Z
|
test/support/edge_cases/multiple_def_cases/various.ex
|
Ajwah/ex_debugger
|
44cd5b99c0b7751db052887b7a0bc3ce52a2972e
|
[
"Apache-2.0"
] | 1
|
2020-07-08T00:04:38.000Z
|
2020-07-08T00:04:38.000Z
|
test/support/edge_cases/multiple_def_cases/various.ex
|
Ajwah/ex_debugger
|
44cd5b99c0b7751db052887b7a0bc3ce52a2972e
|
[
"Apache-2.0"
] | null | null | null |
defmodule Support.EdgeCases.MultipleDefCases.Various do
@moduledoc false
use ExDebugger
def run1,
do:
%{ls: [1, 2, 3, 4]}
|> Map.fetch!(:ls)
|> List.wrap()
|> Enum.reverse()
|> Enum.reduce(0, &(&1 * 2 + &2))
def run2(%{digit: a}, %{digit: b}, %{digit: c}, %{digit: d}) do
%{ls: [a, b, c, d]}
|> Map.fetch!(:ls)
|> List.wrap()
|> Enum.reverse()
|> Enum.reduce(0, &(&1 * 2 + &2))
end
def run3(a, b, c, d) when is_integer(a) and is_integer(b) and is_integer(c) and is_integer(d) do
%{ls: [a, b, c, d]}
|> Map.fetch!(:ls)
|> List.wrap()
|> Enum.reverse()
|> Enum.reduce(0, &(&1 * 2 + &2))
end
def run4(a) do
%{ls: a}
|> Map.fetch!(:ls)
|> List.wrap()
|> Enum.reverse()
|> Enum.reduce(0, &(&1 * 2 + &2))
end
end
| 22.243243
| 98
| 0.490887
|
93b8ca9f9774b7c7cd06a7d01492f24ed621ec53
| 1,566
|
exs
|
Elixir
|
config/config.exs
|
leozhang37/wechat_pay
|
3991ceabc23e8e86c1bee45c9c33f3b028f3fb13
|
[
"MIT"
] | 55
|
2016-10-19T09:01:39.000Z
|
2019-03-23T12:40:21.000Z
|
config/config.exs
|
leozhang37/wechat_pay
|
3991ceabc23e8e86c1bee45c9c33f3b028f3fb13
|
[
"MIT"
] | 20
|
2020-07-06T01:59:19.000Z
|
2022-03-01T01:07:13.000Z
|
config/config.exs
|
leozhang37/wechat_pay
|
3991ceabc23e8e86c1bee45c9c33f3b028f3fb13
|
[
"MIT"
] | 9
|
2017-01-05T04:17:21.000Z
|
2019-02-18T03:52:05.000Z
|
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
# 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 :wechat_pay, key: :value
#
# And access this configuration in your application as:
#
# Application.get_env(:wechat_pay, :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).
use Mix.Config
config :plug, :validate_header_keys_during_test, true
config :wechat_pay, json_library: Poison
config :wechat_pay, TestPay,
api_host: "https://api.mch.weixin.qq.com/sandboxnew/",
app_id: "wx8888888888888888",
mch_id: "1900000109",
api_key: "192006250b4c09247ec02edce69f6a2d",
ssl: [
ca_cert: File.read!("fixture/certs/rootca.pem"),
cert: File.read!("fixture/certs/apiclient_cert.pem"),
key: File.read!("fixture/certs/apiclient_key.pem")
]
| 34.043478
| 73
| 0.750958
|
93b8d582bf93c975ae005dd22c31587d233c3f33
| 1,377
|
exs
|
Elixir
|
test/10_parse/40_internal_functions/id_of_test.exs
|
marick/ecto_test_dsl
|
6d460af093367098b7c78db709753deb45904d77
|
[
"Unlicense"
] | 4
|
2021-02-09T17:26:34.000Z
|
2021-08-08T01:42:52.000Z
|
test/10_parse/40_internal_functions/id_of_test.exs
|
marick/transformer_test_support
|
6d460af093367098b7c78db709753deb45904d77
|
[
"Unlicense"
] | null | null | null |
test/10_parse/40_internal_functions/id_of_test.exs
|
marick/transformer_test_support
|
6d460af093367098b7c78db709753deb45904d77
|
[
"Unlicense"
] | null | null | null |
defmodule Parse.InternalFunctions.IdOfTest do
use EctoTestDSL.Case
use T.Predefines
alias T.Parse.FinishParse
alias T.Parse.BuildState
test "basic parsing" do
assert id_of(animal: Examples) == FieldRef.new(id: een(animal: Examples))
assert id_of(:animal) == FieldRef.new(id: een(animal: __MODULE__))
end
defmodule Examples do
use Template.PhoenixGranular.Insert
end
test "instances of `id_of` generate eens" do
Examples.started()
workflow(:success, ok: [params(a: 1, b: 2)])
workflow(:validation_error, similar: [
params_like(:ok, except: [a: id_of(species: ExampleModule)])
])
test_data =
BuildState.current
|> FinishParse.finish
assert example(test_data, :similar).eens == [een(species: ExampleModule)]
end
test "adds on to existing eens" do
Examples.started(examples_module: ExampleModule)
workflow(:validation_error, name: [
params(
a: id_of(species: ExampleModule),
b: id_of(:thing)),
previously(insert: :noog)
])
test_data =
BuildState.current
|> FinishParse.finish
assert_good_enough(
example(test_data, :name).eens,
in_any_order([een(:noog, ExampleModule),
een(species: ExampleModule),
een(thing: __MODULE__)]))
end
end
| 27
| 77
| 0.633987
|
93b94381f5970c2283ea529364f11bcbc762ee52
| 1,542
|
ex
|
Elixir
|
clients/storage_transfer/lib/google_api/storage_transfer/v1/model/bandwidth_limit.ex
|
corp-momenti/elixir-google-api
|
fe1580e305789ab2ca0741791b8ffe924bd3240c
|
[
"Apache-2.0"
] | null | null | null |
clients/storage_transfer/lib/google_api/storage_transfer/v1/model/bandwidth_limit.ex
|
corp-momenti/elixir-google-api
|
fe1580e305789ab2ca0741791b8ffe924bd3240c
|
[
"Apache-2.0"
] | null | null | null |
clients/storage_transfer/lib/google_api/storage_transfer/v1/model/bandwidth_limit.ex
|
corp-momenti/elixir-google-api
|
fe1580e305789ab2ca0741791b8ffe924bd3240c
|
[
"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.StorageTransfer.V1.Model.BandwidthLimit do
@moduledoc """
Specifies the BandwidthLimit to describe the non-negative bandwidth rate in mbps for the agent pool.
## Attributes
* `limitMbps` (*type:* `String.t`, *default:* `nil`) - Specifies bandwidth rate in mbps distributed across all the agents in the pool.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:limitMbps => String.t() | nil
}
field(:limitMbps)
end
defimpl Poison.Decoder, for: GoogleApi.StorageTransfer.V1.Model.BandwidthLimit do
def decode(value, options) do
GoogleApi.StorageTransfer.V1.Model.BandwidthLimit.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.StorageTransfer.V1.Model.BandwidthLimit do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 32.808511
| 138
| 0.746433
|
93b96dedddf0846646d6ff843296f3bc7f50ae58
| 1,640
|
ex
|
Elixir
|
lib/docusign/model/template_role.ex
|
gaslight/docusign_elixir
|
d9d88d53dd85d32a39d537bade9db28d779414e6
|
[
"MIT"
] | 4
|
2020-12-21T12:50:13.000Z
|
2022-01-12T16:50:43.000Z
|
lib/docusign/model/template_role.ex
|
gaslight/docusign_elixir
|
d9d88d53dd85d32a39d537bade9db28d779414e6
|
[
"MIT"
] | 12
|
2018-09-18T15:26:34.000Z
|
2019-09-28T15:29:39.000Z
|
lib/docusign/model/template_role.ex
|
gaslight/docusign_elixir
|
d9d88d53dd85d32a39d537bade9db28d779414e6
|
[
"MIT"
] | 15
|
2020-04-29T21:50:16.000Z
|
2022-02-11T18:01:51.000Z
|
# 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 DocuSign.Model.TemplateRole do
@moduledoc """
"""
@derive [Poison.Encoder]
defstruct [
:accessCode,
:clientUserId,
:defaultRecipient,
:email,
:emailNotification,
:embeddedRecipientStartURL,
:inPersonSignerName,
:name,
:recipientSignatureProviders,
:roleName,
:routingOrder,
:signingGroupId,
:tabs
]
@type t :: %__MODULE__{
:accessCode => String.t(),
:clientUserId => String.t(),
:defaultRecipient => String.t(),
:email => String.t(),
:emailNotification => RecipientEmailNotification,
:embeddedRecipientStartURL => String.t(),
:inPersonSignerName => String.t(),
:name => String.t(),
:recipientSignatureProviders => [RecipientSignatureProvider],
:roleName => String.t(),
:routingOrder => String.t(),
:signingGroupId => String.t(),
:tabs => EnvelopeRecipientTabs
}
end
defimpl Poison.Decoder, for: DocuSign.Model.TemplateRole do
import DocuSign.Deserializer
def decode(value, options) do
value
|> deserialize(
:emailNotification,
:struct,
DocuSign.Model.RecipientEmailNotification,
options
)
|> deserialize(
:recipientSignatureProviders,
:list,
DocuSign.Model.RecipientSignatureProvider,
options
)
|> deserialize(:tabs, :struct, DocuSign.Model.EnvelopeRecipientTabs, options)
end
end
| 25.625
| 81
| 0.636585
|
93b9a388918c86504ffa08804fb79768e5260ef2
| 1,605
|
exs
|
Elixir
|
apps/socket/test/grapevine_socket/web/socket_handler_test.exs
|
oestrich/grapevine
|
7fb745a3a6e4eb68bd761baa190b2df32fa1f73d
|
[
"MIT"
] | 107
|
2018-10-05T18:20:32.000Z
|
2022-02-28T04:02:50.000Z
|
apps/socket/test/grapevine_socket/web/socket_handler_test.exs
|
oestrich/grapevine
|
7fb745a3a6e4eb68bd761baa190b2df32fa1f73d
|
[
"MIT"
] | 33
|
2018-10-05T14:11:18.000Z
|
2022-02-10T22:19:18.000Z
|
apps/socket/test/grapevine_socket/web/socket_handler_test.exs
|
oestrich/grapevine
|
7fb745a3a6e4eb68bd761baa190b2df32fa1f73d
|
[
"MIT"
] | 18
|
2019-02-03T03:08:20.000Z
|
2021-12-28T04:29:36.000Z
|
defmodule GrapevineSocket.Web.SocketHandlerTest do
use GrapevineSocket.DataCase
alias GrapevineSocket.RateLimit
alias GrapevineSocket.Web.SocketHandler
alias GrapevineSocket.Web.State
describe "incoming messages are rate limited globally" do
test "records current rate of send" do
state = setup_state(%RateLimit{limit: 10})
message = Jason.encode!(%{"event" => "unknown", "payload" => %{}})
{:reply, _reply, state} = SocketHandler.websocket_handle({:text, message}, state)
rate_limit = state.rate_limits["global"]
assert rate_limit.current == 1
assert rate_limit.last_sent_at
end
test "prevents going over your rate" do
state = setup_state(%RateLimit{current: 10, limit: 10})
message = Jason.encode!(%{"event" => "unknown", "payload" => %{}})
{:reply, {:text, reply}, _state} = SocketHandler.websocket_handle({:text, message}, state)
response = Jason.decode!(reply)
assert response["error"] == "rate limit exceeded"
end
test "disconnects you if you get limited too often" do
state = setup_state(%RateLimit{current: 10, limit: 10, total_limited: 10})
message = Jason.encode!(%{"event" => "unknown", "payload" => %{}})
{:reply, {:text, _reply}, _state} = SocketHandler.websocket_handle({:text, message}, state)
assert_receive {:disconnect}
end
end
def setup_state(global_rate_limit) do
%State{
status: "active",
supports: ["channels"],
channels: ["grapevine"],
rate_limits: %{
"global" => global_rate_limit
}
}
end
end
| 30.865385
| 97
| 0.655452
|
93b9a3f1004f19bf52cacaacb45bd95da1ade8a5
| 7,395
|
ex
|
Elixir
|
lib/jsonapi/serializer.ex
|
thebrianemory/jsonapi
|
8a41a1a77a00516c53d7d8831e8c0a5f7a1a09b6
|
[
"MIT"
] | 1
|
2020-10-29T19:28:23.000Z
|
2020-10-29T19:28:23.000Z
|
lib/jsonapi/serializer.ex
|
thebrianemory/jsonapi
|
8a41a1a77a00516c53d7d8831e8c0a5f7a1a09b6
|
[
"MIT"
] | null | null | null |
lib/jsonapi/serializer.ex
|
thebrianemory/jsonapi
|
8a41a1a77a00516c53d7d8831e8c0a5f7a1a09b6
|
[
"MIT"
] | null | null | null |
defmodule JSONAPI.Serializer do
@moduledoc """
Serialize a map of data into a properly formatted JSON API response object
"""
import JSONAPI.Ecto, only: [assoc_loaded?: 1]
alias JSONAPI.{Config, Utils}
alias Utils.String, as: JString
require Logger
@typep serialized_doc :: map()
@doc """
Takes a view, data and a optional plug connection and returns a fully JSONAPI Serialized document.
This assumes you are using the JSONAPI.View and have data in maps or structs.
Please refer to `JSONAPI.View` for more information. If you are in interested in relationships
and includes you may also want to reference the `JSONAPI.QueryParser`.
"""
@spec serialize(module(), term(), Plug.Conn.t() | nil, map() | nil, list()) :: serialized_doc()
def serialize(view, data, conn \\ nil, meta \\ nil, options \\ []) do
{query_includes, query_page} =
case conn do
%Plug.Conn{assigns: %{jsonapi_query: %Config{include: include, page: page}}} ->
{include, page}
_ ->
{[], nil}
end
{to_include, encoded_data} = encode_data(view, data, conn, query_includes, options)
encoded_data = %{
data: encoded_data,
included: flatten_included(to_include)
}
encoded_data =
if is_map(meta) do
Map.put(encoded_data, :meta, meta)
else
encoded_data
end
merge_links(encoded_data, data, view, conn, query_page, remove_links?(), options)
end
def encode_data(_view, nil, _conn, _query_includes, _options), do: {[], nil}
def encode_data(view, data, conn, query_includes, options) when is_list(data) do
Enum.map_reduce(data, [], fn d, acc ->
{to_include, encoded_data} = encode_data(view, d, conn, query_includes, options)
{to_include, acc ++ [encoded_data]}
end)
end
def encode_data(view, data, conn, query_includes, options) do
valid_includes = get_includes(view, query_includes)
encoded_data = %{
id: view.id(data),
type: view.type(),
attributes: transform_fields(view.attributes(data, conn)),
relationships: %{}
}
doc = merge_links(encoded_data, data, view, conn, nil, remove_links?(), options)
doc =
case view.meta(data, conn) do
nil -> doc
meta -> Map.put(doc, :meta, meta)
end
encode_relationships(conn, doc, {view, data, query_includes, valid_includes}, options)
end
@spec encode_relationships(Plug.Conn.t(), serialized_doc(), tuple(), list()) :: tuple()
def encode_relationships(conn, doc, {view, data, _, _} = view_info, options) do
view.relationships()
|> Enum.filter(&data_loaded?(Map.get(data, elem(&1, 0))))
|> Enum.map_reduce(doc, &build_relationships(conn, view_info, &1, &2, options))
end
@spec build_relationships(Plug.Conn.t(), tuple(), tuple(), tuple(), list()) :: tuple()
def build_relationships(
conn,
{view, data, query_includes, valid_includes},
{key, include_view},
acc,
options
) do
rel_view =
case include_view do
{view, :include} -> view
view -> view
end
rel_data = Map.get(data, key)
# Build the relationship url
rel_key = transform_fields(key)
rel_url = view.url_for_rel(data, rel_key, conn)
# Build the relationship
acc =
put_in(
acc,
[:relationships, rel_key],
encode_relation({rel_view, rel_data, rel_url, conn})
)
valid_include_view = include_view(valid_includes, key)
if {rel_view, :include} == valid_include_view && data_loaded?(rel_data) do
rel_query_includes =
if is_list(query_includes) do
query_includes
|> Enum.reduce([], fn
{^key, value}, acc -> acc ++ [value]
_, acc -> acc
end)
|> List.flatten()
else
[]
end
{rel_included, encoded_rel} =
encode_data(rel_view, rel_data, conn, rel_query_includes, options)
{rel_included ++ [encoded_rel], acc}
else
{nil, acc}
end
end
defp include_view(valid_includes, key) when is_list(valid_includes) do
valid_includes
|> Keyword.get(key)
|> generate_view_tuple
end
defp include_view(view, _key), do: generate_view_tuple(view)
defp generate_view_tuple({view, :include}), do: {view, :include}
defp generate_view_tuple(view) when is_atom(view), do: {view, :include}
@spec data_loaded?(map() | list()) :: boolean()
def data_loaded?(rel_data) do
assoc_loaded?(rel_data) && (is_map(rel_data) || is_list(rel_data))
end
@spec encode_relation(tuple()) :: map()
def encode_relation({rel_view, rel_data, _rel_url, _conn} = info) do
data = %{
data: encode_rel_data(rel_view, rel_data)
}
merge_related_links(data, info, remove_links?())
end
defp merge_base_links(%{links: links} = doc, data, view, conn) do
view_links = Map.merge(view.links(data, conn), links)
Map.merge(doc, %{links: view_links})
end
defp merge_links(doc, data, view, conn, page, false, options) when is_list(data) do
links =
Map.merge(view.pagination_links(data, conn, page, options), %{
self: view.url_for_pagination(data, conn, page)
})
doc
|> Map.merge(%{links: links})
|> merge_base_links(data, view, conn)
end
defp merge_links(doc, data, view, conn, _page, false, _options) do
doc
|> Map.merge(%{links: %{self: view.url_for(data, conn)}})
|> merge_base_links(data, view, conn)
end
defp merge_links(doc, _data, _view, _conn, _page, _remove_links, _options), do: doc
defp merge_related_links(
encoded_data,
{rel_view, rel_data, rel_url, conn},
false = _remove_links
) do
Map.merge(encoded_data, %{links: %{self: rel_url, related: rel_view.url_for(rel_data, conn)}})
end
defp merge_related_links(encoded_rel_data, _info, _remove_links), do: encoded_rel_data
@spec encode_rel_data(module(), map() | list()) :: map() | nil
def encode_rel_data(_view, nil), do: nil
def encode_rel_data(view, data) when is_list(data) do
Enum.map(data, &encode_rel_data(view, &1))
end
def encode_rel_data(view, data) do
%{
type: view.type(),
id: view.id(data)
}
end
# Flatten and unique all the included objects
@spec flatten_included(keyword()) :: keyword()
def flatten_included(included) do
included
|> List.flatten()
|> Enum.reject(&is_nil/1)
|> Enum.uniq()
end
defp get_includes(view, query_includes) do
includes = get_default_includes(view) ++ get_query_includes(view, query_includes)
Enum.uniq(includes)
end
defp get_default_includes(view) do
rels = view.relationships()
Enum.filter(rels, fn
{_k, {_v, :include}} -> true
_ -> false
end)
end
defp get_query_includes(view, query_includes) do
rels = view.relationships()
query_includes
|> Enum.map(fn
{include, _} -> Keyword.take(rels, [include])
include -> Keyword.take(rels, [include])
end)
|> List.flatten()
end
defp remove_links?, do: Application.get_env(:jsonapi, :remove_links, false)
defp transform_fields(fields) do
case JString.field_transformation() do
:camelize -> JString.expand_fields(fields, &JString.camelize/1)
:dasherize -> JString.expand_fields(fields, &JString.dasherize/1)
_ -> fields
end
end
end
| 28.886719
| 100
| 0.647194
|
93b9af063371a49674c17ed7b501ff843f2a9ee5
| 2,356
|
ex
|
Elixir
|
lib/ratethedub_web/controllers/anime_controller.ex
|
rushsteve1/RateTheDub
|
89a8ad8ab42d2a55f1c522ba78dc4ac3a7f84081
|
[
"Apache-2.0"
] | 4
|
2021-04-26T21:50:45.000Z
|
2021-04-27T18:37:51.000Z
|
lib/ratethedub_web/controllers/anime_controller.ex
|
rushsteve1/RateTheDub
|
89a8ad8ab42d2a55f1c522ba78dc4ac3a7f84081
|
[
"Apache-2.0"
] | 25
|
2021-04-26T21:39:21.000Z
|
2021-09-07T13:59:14.000Z
|
lib/ratethedub_web/controllers/anime_controller.ex
|
rushsteve1/RateTheDub
|
89a8ad8ab42d2a55f1c522ba78dc4ac3a7f84081
|
[
"Apache-2.0"
] | null | null | null |
defmodule RateTheDubWeb.AnimeController do
use RateTheDubWeb, :controller
alias RateTheDub.Anime
alias RateTheDub.DubVotes
alias RateTheDub.DubVotes.Vote
@six_months 15_778_800
@cookie_name "snowflake"
def show(conn, %{"id" => id}) do
id = String.to_integer(id)
{ip, snowflake} = user_info(conn)
render_series(conn, id, ip, snowflake)
end
def vote(conn, %{"id" => id}) do
id = String.to_integer(id)
{ip, snowflake} = user_info(conn)
has_voted = DubVotes.has_voted_for(id, conn.assigns.locale, ip, snowflake)
conn =
if has_voted do
put_flash(conn, :error, gettext("You've already voted for this"))
else
{:ok, _} =
DubVotes.create_vote(%{
mal_id: id,
language: conn.assigns.locale,
user_ip: ip,
user_snowflake: snowflake
})
put_flash(conn, :vote, gettext("Vote Recorded"))
end
conn
|> put_resp_cookie(@cookie_name, snowflake, max_age: @six_months, encrypt: true)
|> render_series(id, ip, snowflake)
end
def undo(conn, %{"id" => id}) do
id = String.to_integer(id)
{ip, snowflake} = user_info(conn)
has_voted = DubVotes.has_voted_for(id, conn.assigns.locale, ip, snowflake)
if has_voted do
{:ok, _} =
DubVotes.delete_vote(%Vote{
mal_id: id,
language: conn.assigns.locale,
user_ip: ip,
user_snowflake: snowflake
})
put_flash(conn, :info, gettext("Vote Undone"))
|> render_series(id, ip, snowflake)
else
conn
|> render_series(id, ip, snowflake)
end
end
defp render_series(conn, id, ip, snowflake) when is_integer(id) do
series = Anime.get_or_create_anime_series!(id)
render(conn, "show.html",
series: series,
count: DubVotes.count_votes_for(id, conn.assigns.locale),
all_counts: DubVotes.count_all_votes_for(id),
char_actors: Anime.character_actor_pairs_for_lang(series, conn.assigns.locale),
has_voted: DubVotes.has_voted_for(id, conn.assigns.locale, ip, snowflake)
)
end
defp user_info(conn) do
conn = fetch_cookies(conn, encrypted: [@cookie_name])
ip = conn.remote_ip |> :inet_parse.ntoa() |> to_string()
snow = conn.cookies[@cookie_name] || DubVotes.Vote.make_snowflake(ip)
{ip, snow}
end
end
| 27.717647
| 85
| 0.640917
|
93b9ebb965cd22e4a012fe39b5b1e472d6aba351
| 368
|
ex
|
Elixir
|
web/views/error_view.ex
|
ShaneKilkelly/marc
|
8ee86ad1517667a34e706597abaf9ed346971d31
|
[
"MIT"
] | 11
|
2016-12-05T17:44:46.000Z
|
2018-09-15T15:54:41.000Z
|
web/views/error_view.ex
|
ShaneKilkelly/marc
|
8ee86ad1517667a34e706597abaf9ed346971d31
|
[
"MIT"
] | null | null | null |
web/views/error_view.ex
|
ShaneKilkelly/marc
|
8ee86ad1517667a34e706597abaf9ed346971d31
|
[
"MIT"
] | null | null | null |
defmodule Marc.ErrorView do
use Marc.Web, :view
def render("404.html", _assigns) do
"Page not found"
end
def render("500.html", _assigns) do
"Internal server error"
end
# In case no render clause matches or no
# template is found, let's render it as 500
def template_not_found(_template, assigns) do
render "500.html", assigns
end
end
| 20.444444
| 47
| 0.692935
|
93b9f3b44f45fdb72b53585e1ed5027111fe30f8
| 1,091
|
ex
|
Elixir
|
elixir_tags/lib/elixir_tags/application.ex
|
DinowSauron/Projeto-Next-Level-Week-7-Heat
|
fc20ed5ca61aff8af37a6120ce6fcffb9907357d
|
[
"MIT"
] | null | null | null |
elixir_tags/lib/elixir_tags/application.ex
|
DinowSauron/Projeto-Next-Level-Week-7-Heat
|
fc20ed5ca61aff8af37a6120ce6fcffb9907357d
|
[
"MIT"
] | null | null | null |
elixir_tags/lib/elixir_tags/application.ex
|
DinowSauron/Projeto-Next-Level-Week-7-Heat
|
fc20ed5ca61aff8af37a6120ce6fcffb9907357d
|
[
"MIT"
] | null | null | null |
defmodule ElixirTags.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
# Start the Ecto repository
ElixirTags.Repo,
# Start the Telemetry supervisor
ElixirTagsWeb.Telemetry,
# Start the PubSub system
{Phoenix.PubSub, name: ElixirTags.PubSub},
# Start the Endpoint (http/https)
ElixirTagsWeb.Endpoint,
# Start a worker by calling: ElixirTags.Worker.start_link(arg)
# {ElixirTags.Worker, arg}
ElixirTags.Scheduler
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: ElixirTags.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
@impl true
def config_change(changed, _new, removed) do
ElixirTagsWeb.Endpoint.config_change(changed, removed)
:ok
end
end
| 28.710526
| 68
| 0.706691
|
93ba0e74b92512d7c7ab9e42c132ecb9b0d9755f
| 3,557
|
ex
|
Elixir
|
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_v2_detect_intent_response.ex
|
kolorahl/elixir-google-api
|
46bec1e092eb84c6a79d06c72016cb1a13777fa6
|
[
"Apache-2.0"
] | null | null | null |
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_v2_detect_intent_response.ex
|
kolorahl/elixir-google-api
|
46bec1e092eb84c6a79d06c72016cb1a13777fa6
|
[
"Apache-2.0"
] | null | null | null |
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_v2_detect_intent_response.ex
|
kolorahl/elixir-google-api
|
46bec1e092eb84c6a79d06c72016cb1a13777fa6
|
[
"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.Dialogflow.V2.Model.GoogleCloudDialogflowV2DetectIntentResponse do
@moduledoc """
The message returned from the DetectIntent method.
## Attributes
* `outputAudio` (*type:* `String.t`, *default:* `nil`) - The audio data bytes encoded as specified in the request.
Note: The output audio is generated based on the values of default platform
text responses found in the `query_result.fulfillment_messages` field. If
multiple default text responses exist, they will be concatenated when
generating audio. If no default platform text responses exist, the
generated audio content will be empty.
In some scenarios, multiple output audio fields may be present in the
response structure. In these cases, only the top-most-level audio output
has content.
* `outputAudioConfig` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2OutputAudioConfig.t`, *default:* `nil`) - The config used by the speech synthesizer to generate the output audio.
* `queryResult` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2QueryResult.t`, *default:* `nil`) - The selected results of the conversational query or event processing.
See `alternative_query_results` for additional potential results.
* `responseId` (*type:* `String.t`, *default:* `nil`) - The unique identifier of the response. It can be used to
locate a response in the training example set or for reporting issues.
* `webhookStatus` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus.t`, *default:* `nil`) - Specifies the status of the webhook request.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:outputAudio => String.t(),
:outputAudioConfig =>
GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2OutputAudioConfig.t(),
:queryResult => GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2QueryResult.t(),
:responseId => String.t(),
:webhookStatus => GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus.t()
}
field(:outputAudio)
field(:outputAudioConfig,
as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2OutputAudioConfig
)
field(:queryResult, as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2QueryResult)
field(:responseId)
field(:webhookStatus, as: GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus)
end
defimpl Poison.Decoder,
for: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2DetectIntentResponse do
def decode(value, options) do
GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2DetectIntentResponse.decode(
value,
options
)
end
end
defimpl Poison.Encoder,
for: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2DetectIntentResponse do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 44.4625
| 202
| 0.746978
|
93ba3815504267aed186f458ef144a7e78ab80b0
| 32,381
|
ex
|
Elixir
|
lib/aws/generated/waf_v2.ex
|
qyon-brazil/aws-elixir
|
f7f21bebffc6776f95ffe9ef563cf368773438af
|
[
"Apache-2.0"
] | null | null | null |
lib/aws/generated/waf_v2.ex
|
qyon-brazil/aws-elixir
|
f7f21bebffc6776f95ffe9ef563cf368773438af
|
[
"Apache-2.0"
] | null | null | null |
lib/aws/generated/waf_v2.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.WAFV2 do
@moduledoc """
This is the latest version of the **AWS WAF** API, released in November, 2019.
The names of the entities that you use to access this API, like endpoints and
namespaces, all have the versioning information added, like "V2" or "v2", to
distinguish from the prior version. We recommend migrating your resources to
this version, because it has a number of significant improvements.
If you used AWS WAF prior to this release, you can't use this AWS WAFV2 API to
access any AWS WAF resources that you created before. You can access your old
rules, web ACLs, and other AWS WAF resources only through the AWS WAF Classic
APIs. The AWS WAF Classic APIs have retained the prior names, endpoints, and
namespaces.
For information, including how to migrate your AWS WAF resources to this
version, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
AWS WAF is a web application firewall that lets you monitor the HTTP and HTTPS
requests that are forwarded to Amazon CloudFront, an Amazon API Gateway REST
API, an Application Load Balancer, or an AWS AppSync GraphQL API. AWS WAF also
lets you control access to your content. Based on conditions that you specify,
such as the IP addresses that requests originate from or the values of query
strings, the API Gateway REST API, CloudFront distribution, the Application Load
Balancer, or the AWS AppSync GraphQL API responds to requests either with the
requested content or with an HTTP 403 status code (Forbidden). You also can
configure CloudFront to return a custom error page when a request is blocked.
This API guide is for developers who need detailed information about AWS WAF API
actions, data types, and errors. For detailed information about AWS WAF features
and an overview of how to use AWS WAF, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/).
You can make calls using the endpoints listed in [AWS Service Endpoints for AWS WAF](https://docs.aws.amazon.com/general/latest/gr/rande.html#waf_region).
* For regional applications, you can use any of the endpoints in the
list. A regional application can be an Application Load Balancer (ALB), an API
Gateway REST API, or an AppSync GraphQL API.
* For AWS CloudFront applications, you must use the API endpoint
listed for US East (N. Virginia): us-east-1.
Alternatively, you can use one of the AWS SDKs to access an API that's tailored
to the programming language or platform that you're using. For more information,
see [AWS SDKs](http://aws.amazon.com/tools/#SDKs).
We currently provide two versions of the AWS WAF API: this API and the prior
versions, the classic AWS WAF APIs. This new API provides the same functionality
as the older versions, with the following major improvements:
* You use one API for both global and regional applications. Where
you need to distinguish the scope, you specify a `Scope` parameter and set it to
`CLOUDFRONT` or `REGIONAL`.
* You can define a Web ACL or rule group with a single call, and
update it with a single call. You define all rule specifications in JSON format,
and pass them to your rule group or Web ACL calls.
* The limits AWS WAF places on the use of rules more closely
reflects the cost of running each type of rule. Rule groups include capacity
settings, so you know the maximum cost of a rule group when you use it.
"""
alias AWS.Client
alias AWS.Request
def metadata do
%AWS.ServiceMetadata{
abbreviation: "WAFV2",
api_version: "2019-07-29",
content_type: "application/x-amz-json-1.1",
credential_scope: nil,
endpoint_prefix: "wafv2",
global?: false,
protocol: "json",
service_id: "WAFV2",
signature_version: "v4",
signing_name: "wafv2",
target_prefix: "AWSWAF_20190729"
}
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Associates a Web ACL with a regional application resource, to protect the
resource. A regional application can be an Application Load Balancer (ALB), an
API Gateway REST API, or an AppSync GraphQL API.
For AWS CloudFront, don't use this call. Instead, use your CloudFront
distribution configuration. To associate a Web ACL, in the CloudFront call
`UpdateDistribution`, set the web ACL ID to the Amazon Resource Name (ARN) of
the Web ACL. For information, see
[UpdateDistribution](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html).
"""
def associate_web_acl(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "AssociateWebACL", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Returns the web ACL capacity unit (WCU) requirements for a specified scope and
set of rules. You can use this to check the capacity requirements for the rules
you want to use in a `RuleGroup` or `WebACL`.
AWS WAF uses WCUs to calculate and control the operating resources that are used
to run your rules, rule groups, and web ACLs. AWS WAF calculates capacity
differently for each rule type, to reflect the relative cost of each rule.
Simple rules that cost little to run use fewer WCUs than more complex rules that
use more processing power. Rule group capacity is fixed at creation, which helps
users plan their web ACL WCU usage when they use a rule group. The WCU limit for
web ACLs is 1,500.
"""
def check_capacity(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "CheckCapacity", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Creates an `IPSet`, which you use to identify web requests that originate from
specific IP addresses or ranges of IP addresses. For example, if you're
receiving a lot of requests from a ranges of IP addresses, you can configure AWS
WAF to block them using an IPSet that lists those IP addresses.
"""
def create_ip_set(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "CreateIPSet", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Creates a `RegexPatternSet`, which you reference in a
`RegexPatternSetReferenceStatement`, to have AWS WAF inspect a web request
component for the specified patterns.
"""
def create_regex_pattern_set(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "CreateRegexPatternSet", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Creates a `RuleGroup` per the specifications provided.
A rule group defines a collection of rules to inspect and control web requests
that you can use in a `WebACL`. When you create a rule group, you define an
immutable capacity limit. If you update a rule group, you must stay within the
capacity. This allows others to reuse the rule group with confidence in its
capacity requirements.
"""
def create_rule_group(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "CreateRuleGroup", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Creates a `WebACL` per the specifications provided.
A Web ACL defines a collection of rules to use to inspect and control web
requests. Each rule has an action defined (allow, block, or count) for requests
that match the statement of the rule. In the Web ACL, you assign a default
action to take (allow, block) for any request that does not match any of the
rules. The rules in a Web ACL can be a combination of the types `Rule`,
`RuleGroup`, and managed rule group. You can associate a Web ACL with one or
more AWS resources to protect. The resources can be Amazon CloudFront, an Amazon
API Gateway REST API, an Application Load Balancer, or an AWS AppSync GraphQL
API.
"""
def create_web_acl(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "CreateWebACL", input, options)
end
@doc """
Deletes all rule groups that are managed by AWS Firewall Manager for the
specified web ACL.
You can only use this if `ManagedByFirewallManager` is false in the specified
`WebACL`.
"""
def delete_firewall_manager_rule_groups(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DeleteFirewallManagerRuleGroups", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Deletes the specified `IPSet`.
"""
def delete_ip_set(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DeleteIPSet", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Deletes the `LoggingConfiguration` from the specified web ACL.
"""
def delete_logging_configuration(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DeleteLoggingConfiguration", input, options)
end
@doc """
Permanently deletes an IAM policy from the specified rule group.
You must be the owner of the rule group to perform this operation.
"""
def delete_permission_policy(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DeletePermissionPolicy", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Deletes the specified `RegexPatternSet`.
"""
def delete_regex_pattern_set(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DeleteRegexPatternSet", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Deletes the specified `RuleGroup`.
"""
def delete_rule_group(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DeleteRuleGroup", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Deletes the specified `WebACL`.
You can only use this if `ManagedByFirewallManager` is false in the specified
`WebACL`.
"""
def delete_web_acl(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DeleteWebACL", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Provides high-level information for a managed rule group, including descriptions
of the rules.
"""
def describe_managed_rule_group(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DescribeManagedRuleGroup", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Disassociates a Web ACL from a regional application resource. A regional
application can be an Application Load Balancer (ALB), an API Gateway REST API,
or an AppSync GraphQL API.
For AWS CloudFront, don't use this call. Instead, use your CloudFront
distribution configuration. To disassociate a Web ACL, provide an empty web ACL
ID in the CloudFront call `UpdateDistribution`. For information, see
[UpdateDistribution](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html).
"""
def disassociate_web_acl(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "DisassociateWebACL", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves the specified `IPSet`.
"""
def get_ip_set(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetIPSet", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Returns the `LoggingConfiguration` for the specified web ACL.
"""
def get_logging_configuration(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetLoggingConfiguration", input, options)
end
@doc """
Returns the IAM policy that is attached to the specified rule group.
You must be the owner of the rule group to perform this operation.
"""
def get_permission_policy(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetPermissionPolicy", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves the keys that are currently blocked by a rate-based rule. The maximum
number of managed keys that can be blocked for a single rate-based rule is
10,000. If more than 10,000 addresses exceed the rate limit, those with the
highest rates are blocked.
"""
def get_rate_based_statement_managed_keys(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetRateBasedStatementManagedKeys", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves the specified `RegexPatternSet`.
"""
def get_regex_pattern_set(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetRegexPatternSet", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves the specified `RuleGroup`.
"""
def get_rule_group(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetRuleGroup", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Gets detailed information about a specified number of requests--a sample--that
AWS WAF randomly selects from among the first 5,000 requests that your AWS
resource received during a time range that you choose. You can specify a sample
size of up to 500 requests, and you can specify any time range in the previous
three hours.
`GetSampledRequests` returns a time range, which is usually the time range that
you specified. However, if your resource (such as a CloudFront distribution)
received 5,000 requests before the specified time range elapsed,
`GetSampledRequests` returns an updated time range. This new time range
indicates the actual period during which AWS WAF selected the requests in the
sample.
"""
def get_sampled_requests(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetSampledRequests", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves the specified `WebACL`.
"""
def get_web_acl(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetWebACL", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves the `WebACL` for the specified resource.
"""
def get_web_acl_for_resource(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "GetWebACLForResource", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves an array of managed rule groups that are available for you to use.
This list includes all AWS Managed Rules rule groups and the AWS Marketplace
managed rule groups that you're subscribed to.
"""
def list_available_managed_rule_groups(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "ListAvailableManagedRuleGroups", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves an array of `IPSetSummary` objects for the IP sets that you manage.
"""
def list_ip_sets(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "ListIPSets", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves an array of your `LoggingConfiguration` objects.
"""
def list_logging_configurations(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "ListLoggingConfigurations", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves an array of `RegexPatternSetSummary` objects for the regex pattern
sets that you manage.
"""
def list_regex_pattern_sets(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "ListRegexPatternSets", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves an array of the Amazon Resource Names (ARNs) for the regional
resources that are associated with the specified web ACL. If you want the list
of AWS CloudFront resources, use the AWS CloudFront call
`ListDistributionsByWebACLId`.
"""
def list_resources_for_web_acl(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "ListResourcesForWebACL", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves an array of `RuleGroupSummary` objects for the rule groups that you
manage.
"""
def list_rule_groups(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "ListRuleGroups", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves the `TagInfoForResource` for the specified resource. Tags are
key:value pairs that you can use to categorize and manage your resources, for
purposes like billing. For example, you might set the tag key to "customer" and
the value to the customer name or ID. You can specify one or more tags to add to
each AWS resource, up to 50 tags for a resource.
You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule
groups, IP sets, and regex pattern sets. You can't manage or view tags through
the AWS WAF console.
"""
def list_tags_for_resource(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "ListTagsForResource", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Retrieves an array of `WebACLSummary` objects for the web ACLs that you manage.
"""
def list_web_acls(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "ListWebACLs", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Enables the specified `LoggingConfiguration`, to start logging from a web ACL,
according to the configuration provided.
You can access information about all traffic that AWS WAF inspects using the
following steps:
1. Create an Amazon Kinesis Data Firehose.
Create the data firehose with a PUT source and in the Region that you are
operating. If you are capturing logs for Amazon CloudFront, always create the
firehose in US East (N. Virginia).
Give the data firehose a name that starts with the prefix `aws-waf-logs-`. For
example, `aws-waf-logs-us-east-2-analytics`.
Do not create the data firehose using a `Kinesis stream` as your source.
2. Associate that firehose to your web ACL using a
`PutLoggingConfiguration` request.
When you successfully enable logging using a `PutLoggingConfiguration` request,
AWS WAF will create a service linked role with the necessary permissions to
write logs to the Amazon Kinesis Data Firehose. For more information, see
[Logging Web ACL Traffic Information](https://docs.aws.amazon.com/waf/latest/developerguide/logging.html)
in the *AWS WAF Developer Guide*.
"""
def put_logging_configuration(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "PutLoggingConfiguration", input, options)
end
@doc """
Attaches an IAM policy to the specified resource.
Use this to share a rule group across accounts.
You must be the owner of the rule group to perform this operation.
This action is subject to the following restrictions:
* You can attach only one policy with each `PutPermissionPolicy`
request.
* The ARN in the request must be a valid WAF `RuleGroup` ARN and the
rule group must exist in the same region.
* The user making the request must be the owner of the rule group.
"""
def put_permission_policy(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "PutPermissionPolicy", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Associates tags with the specified AWS resource. Tags are key:value pairs that
you can use to categorize and manage your resources, for purposes like billing.
For example, you might set the tag key to "customer" and the value to the
customer name or ID. You can specify one or more tags to add to each AWS
resource, up to 50 tags for a resource.
You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule
groups, IP sets, and regex pattern sets. You can't manage or view tags through
the AWS WAF console.
"""
def tag_resource(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "TagResource", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Disassociates tags from an AWS resource. Tags are key:value pairs that you can
associate with AWS resources. For example, the tag key might be "customer" and
the tag value might be "companyA." You can specify one or more tags to add to
each container. You can add up to 50 tags to each AWS resource.
"""
def untag_resource(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "UntagResource", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Updates the specified `IPSet`.
"""
def update_ip_set(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "UpdateIPSet", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Updates the specified `RegexPatternSet`.
"""
def update_regex_pattern_set(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "UpdateRegexPatternSet", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Updates the specified `RuleGroup`.
A rule group defines a collection of rules to inspect and control web requests
that you can use in a `WebACL`. When you create a rule group, you define an
immutable capacity limit. If you update a rule group, you must stay within the
capacity. This allows others to reuse the rule group with confidence in its
capacity requirements.
"""
def update_rule_group(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "UpdateRuleGroup", input, options)
end
@doc """
This is the latest version of **AWS WAF**, named AWS WAFV2, released in
November, 2019.
For information, including how to migrate your AWS WAF resources from the prior
release, see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
Updates the specified `WebACL`.
A Web ACL defines a collection of rules to use to inspect and control web
requests. Each rule has an action defined (allow, block, or count) for requests
that match the statement of the rule. In the Web ACL, you assign a default
action to take (allow, block) for any request that does not match any of the
rules. The rules in a Web ACL can be a combination of the types `Rule`,
`RuleGroup`, and managed rule group. You can associate a Web ACL with one or
more AWS resources to protect. The resources can be Amazon CloudFront, an Amazon
API Gateway REST API, an Application Load Balancer, or an AWS AppSync GraphQL
API.
"""
def update_web_acl(%Client{} = client, input, options \\ []) do
Request.request_post(client, metadata(), "UpdateWebACL", input, options)
end
end
| 44.236339
| 156
| 0.738087
|
93ba44f0cd9fdb72eeefa8a46543849721cd6974
| 2,035
|
exs
|
Elixir
|
bench/ring.exs
|
edescourtis/libring
|
76d7add89389b2f66901778af2a9a2b8a3a37bb9
|
[
"MIT"
] | 181
|
2016-09-29T12:57:03.000Z
|
2022-02-12T12:50:55.000Z
|
bench/ring.exs
|
edescourtis/libring
|
76d7add89389b2f66901778af2a9a2b8a3a37bb9
|
[
"MIT"
] | 26
|
2016-12-12T22:22:43.000Z
|
2021-12-15T15:52:06.000Z
|
bench/ring.exs
|
edescourtis/libring
|
76d7add89389b2f66901778af2a9a2b8a3a37bb9
|
[
"MIT"
] | 22
|
2017-04-28T08:08:44.000Z
|
2022-01-27T16:18:20.000Z
|
Application.ensure_all_started(:libring)
# The raw datastructure
ring = HashRing.new(:'a@nohost')
ring = HashRing.add_node(ring, :'b@nohost')
# The managed version of the ring is a GenServer
# which means there is overhead when manipulating
# the ring or mapping keys to the ring. This translates
# into being roughly 4-5x slower
{:ok, _pid} = HashRing.Managed.new(:test)
:ok = HashRing.Managed.add_node(:test, :'a@nohost')
:ok = HashRing.Managed.add_node(:test, :'b@nohost')
# NOTE: Uncomment the following after adding voicelayer/hash-ring to your deps
# In my tests, HashRing performs 5-10x better at mapping keys to to the ring,
# and HashRing.Managed is roughly 2x better.
# I'm not entirely sure why this is, as hash_ring is implemented with a NIF, but I
# suspect my gb_tree based implementation is just much more efficient at searching the
# ring, and hash_ring uses a naive search or something, anyway, feel free to test yourself
#_ = :hash_ring.start_link()
#:hash_ring.create_ring("test", 128)
#:hash_ring.add_node("test", "a@nohost")
#:hash_ring.add_node("test", "b@nohost")
# The following is for sile/hash_ring, HashRing performs roughly 2x better,
# when used directly, since sile/hash_ring does not implement a managed process,
# there is no way to compare the HashRing.Managed API, but it is roughly 4x slower
# than sile/hash_ring
#nodes = :hash_ring.list_to_nodes([:a, :b])
#ring2 = :hash_ring.make(nodes)
Benchee.run(%{
"HashRing.key_to_node (direct)" => fn ->
for i <- 1..100, do: HashRing.key_to_node(ring, {:myapp, i})
end,
"HashRings.key_to_node (via process)" => fn ->
for i <- 1..100, do: HashRing.Managed.key_to_node(:test, {:myapp, i})
end,
#"voicelayer/hash_ring.find_node" => fn ->
# for i <- 1..100, do: :hash_ring.find_node("test", :erlang.term_to_binary({:myapp, i}))
#end,
#"sile/hash_ring.find_node" => fn ->
# for i <- 1..100, do: :hash_ring.find_node(:erlang.term_to_binary({:myapp, i}), ring2)
#end,
}, time: 10)
| 42.395833
| 95
| 0.699263
|
93ba4a49a28b4baa9cb74bdac8578036e3733e33
| 1,674
|
exs
|
Elixir
|
Day_2/part2.exs
|
andrefmrocha/Advent_Of_Code_2019
|
44334b96a27c4b62ca78c79e3fef498b53577728
|
[
"MIT"
] | 1
|
2019-12-12T12:37:59.000Z
|
2019-12-12T12:37:59.000Z
|
Day_2/part2.exs
|
andrefmrocha/Advent_Of_Code_2019
|
44334b96a27c4b62ca78c79e3fef498b53577728
|
[
"MIT"
] | null | null | null |
Day_2/part2.exs
|
andrefmrocha/Advent_Of_Code_2019
|
44334b96a27c4b62ca78c79e3fef498b53577728
|
[
"MIT"
] | null | null | null |
defmodule Day2 do
defp read_input() do
File.read!('input.txt')
|> String.split(",", trim: true)
|> Enum.map(&String.trim/1)
|> Enum.map(&String.to_integer/1)
end
defp addition(values, second, third) do
firstValue = Enum.at(values, second)
secondValue = Enum.at(values, third)
firstValue + secondValue
end
defp multiply(values, second, third) do
firstValue = Enum.at(values, second)
secondValue = Enum.at(values, third)
firstValue * secondValue
end
defp update_value(value, fourth, values) do
List.update_at(values, fourth, fn _ -> value end)
end
defp process_data(values, index) do
first = Enum.at(values, index)
second = Enum.at(values, index + 1)
third = Enum.at(values, index + 2)
fourth = Enum.at(values, index + 3)
cond do
first == 1 ->
addition(values, second, third)
|> update_value(fourth, values)
|> process_data(index + 4)
first == 2 ->
multiply(values, second, third)
|> update_value(fourth, values)
|> process_data(index + 4)
true ->
Enum.at(values, 0)
end
end
defp check_value(value) do
value == 19690720
end
defp try_values(input, values) do
Enum.find(values, -1, fn noun ->
verb = Enum.find(values, -1, fn verb ->
List.update_at(input, 1, fn _ -> noun end)
|> List.update_at(2, fn _ -> verb end)
|> process_data(0)
|> check_value
end)
if verb != -1 do
IO.puts(verb)
end
verb != -1
end)
end
def main() do
read_input()
|> try_values(Enum.to_list( 0..100))
|> IO.puts
end
end
Day2.main()
| 22.931507
| 53
| 0.592593
|
93ba63bf7ce60215bee4a2ddba34fa8bce2f87e4
| 4,954
|
ex
|
Elixir
|
lib/multibase/base8.ex
|
Stebalien/ex-multibase
|
beddfe5fd0d24921564271483d71e7ae0798d697
|
[
"MIT"
] | 3
|
2018-11-14T18:21:51.000Z
|
2020-11-02T17:11:02.000Z
|
lib/multibase/base8.ex
|
Stebalien/ex-multibase
|
beddfe5fd0d24921564271483d71e7ae0798d697
|
[
"MIT"
] | null | null | null |
lib/multibase/base8.ex
|
Stebalien/ex-multibase
|
beddfe5fd0d24921564271483d71e7ae0798d697
|
[
"MIT"
] | 2
|
2019-07-26T19:10:59.000Z
|
2021-05-19T10:04:13.000Z
|
defmodule Base8 do
@moduledoc false
# """
# This module provides encoding and decoding for Base-8.
# """
#TODO: Replace with a macro
alphabet_encoding = Enum.with_index('01234567')
@doc """
Encodes a binary in Base-8.
## Options
The accepted options are:
:padding - specifies whether or not to pad leading zeroes when encoding to preserve full transparency.
The values for :padding can be:
* true - pad leading zeroes
* false - ignore leading zeroes (default), faster
## Examples
iex> Base8.encode8("hello")
"6414533066157"
iex> Base8.encode8(<<0, 0, "hello">>, padding: false)
"6414533066157"
iex> Base8.encode8(<<0, 0, "hello">>, padding: true)
"006414533066157"
"""
@spec encode8(binary(), keyword()) :: binary()
def encode8(data, opts \\ []) when is_binary(data) do
pad? = Keyword.get(opts, :padding, false)
do_encode8(data, pad?)
end
@doc """
Decodes a Base-8 binary.
An ArgumentError is raised if the string is not a valid Base-8 string.
## Options
The accepted options are:
:padding - specifies whether or not to pad leading zeroes when decoding to preserve full transparency.
The values for :padding can be:
* true - check for padded leading zeroes
* false - ignore leading zeroes (default), faster
## Examples
iex> Base8.decode8!("6414533066157")
"hello"
iex> Base8.decode8!("006414533066157", padding: false)
"hello"
iex> Base8.decode8!("006414533066157", padding: true)
<<0, 0, 104, 101, 108, 108, 111>>
"""
@spec decode8!(binary(), keyword()) :: binary()
def decode8!(string, opts \\ [])
def decode8!(string, opts) when is_binary(string) do
pad? = Keyword.get(opts, :padding, false)
do_decode8(string, pad?)
end
def decode8!(_string, _opts) do
raise ArgumentError, "string must be a valid base8-encoded string."
end
@doc """
Decodes a Base-8 binary.
An error is returned if the string is not a valid Base-8 string.
## Options
The accepted options are:
:padding - specifies whether or not to pad leading zeroes when decoding to preserve full transparency.
The values for :padding can be:
* true - check for padded leading zeroes
* false - ignore leading zeroes (default), faster
## Examples
iex> Base8.decode8("6414533066157")
{:ok, "hello"}
iex> Base8.decode8("006414533066157", padding: false)
{:ok, "hello"}
iex> Base8.decode8("006414533066157", padding: true)
{:ok, <<0, 0, 104, 101, 108, 108, 111>>}
iex> Base8.decode8("006414533066157ABC", padding: true)
:error
"""
@spec decode8(binary(), keyword()) :: {:ok, binary()} | :error
def decode8(string, opts \\ []) do
{:ok, decode8!(string, opts)}
rescue
ArgumentError -> :error
end
#===============================================================================
# Private
#===============================================================================
defp encode_char(value)
for {encoding, value} <- alphabet_encoding do
defp encode_char(unquote(value)), do: unquote(encoding)
end
# if we want custom char decoding, we can do this
# defp decode_char(encoding)
# for {encoding, value} <- alphabet_encoding do
# defp decode_char(unquote(encoding)), do: unquote(value)
# end
#
# defp decode_char(encoding) do
# "non-alphabet digit found: #{inspect(<<encoding>>, binaries: :as_strings)} (byte #{encoding})"
# end
defp encode_prefix(<<0, rest::binary>>, acc) do
encode_prefix(rest, ['0' | acc])
end
defp encode_prefix(_bin, acc) do
acc
end
defp do_encode8(<<>>, _pad?) do
<<>>
end
defp do_encode8(data, false) do
encode_body(data) |> to_string()
end
defp do_encode8(data, true) do
encoded_prefix = encode_prefix(data, [])
body = encode_body(data)
[encoded_prefix | body] |> to_string()
end
defp encode_body(data) do
# this performs better than :binary.decode_unsigned(data) |> Integer.to_string(8) typically for base8
encode_body(data |> :binary.decode_unsigned(), [])
end
defp encode_body(0, acc) do
acc
end
defp encode_body(integer, acc) do
encode_body(div(integer, 8), [encode_char(rem(integer, 8)) | acc])
end
def do_decode8(<<>>, _pad) do
<<>>
end
def do_decode8("0", _pad) do
<<0>>
end
def do_decode8(string, false) do
decode_payload(string)
end
def do_decode8(string, true) do
leading_zeroes_count = count_leading_zeroes(string, 0)
<<0::unsigned-integer-size(leading_zeroes_count)-unit(8), decode_payload(string)::binary>>
end
defp decode_payload(string) do
String.to_integer(string, 8) |> :binary.encode_unsigned()
end
defp count_leading_zeroes(<<"0", rest::binary>>, acc) do
count_leading_zeroes(rest, acc + 1)
end
defp count_leading_zeroes(_string, acc) do
acc
end
end
| 24.646766
| 106
| 0.630803
|
93ba84fe5da19d65d96c737f0e105da8d08efa35
| 3,305
|
ex
|
Elixir
|
lib/bonny_plug/webhook_plug.ex
|
ufirstgroup/bonny_plug
|
4f2b49fd6d3db245745a9b1073be7328721cdb53
|
[
"MIT"
] | 6
|
2020-11-09T15:02:45.000Z
|
2021-04-17T12:50:25.000Z
|
lib/bonny_plug/webhook_plug.ex
|
ufirstgroup/bonny_plug
|
4f2b49fd6d3db245745a9b1073be7328721cdb53
|
[
"MIT"
] | 44
|
2020-12-14T06:55:48.000Z
|
2022-03-28T02:04:08.000Z
|
lib/bonny_plug/webhook_plug.ex
|
ufirstgroup/bonny_plug
|
4f2b49fd6d3db245745a9b1073be7328721cdb53
|
[
"MIT"
] | null | null | null |
defmodule BonnyPlug.WebhookPlug do
@moduledoc """
Plug that processes incoming admission webhook requests. Valid requests are forwarded to given webhook handlers.
You have to specify the `:webhook_type` you want to forward to this plug. The `:webhook_type` has to be be either
`:validating_webhook` or `:mutating_webhook`.
## Examples
### Compile time configuration
In a Phoenix router you would forward post requests to this plug:
post "/admission-review/validate", BonnyPlug.WebhookPlug,
webhook_type: :validating_webhook,
handlers: [MyApp.WebhookHandlers.FooResourceWebhookHandler]
post "/admission-review/mutate", BonnyPlug.WebhookPlug,
webhook_type: :mutating_webhook,
handlers: [MyApp.WebhookHandlers.BarResourceWebhookHandler]
### Runtime configuration
In the example above, the handlers are defined at compile time. If you need to define the handlers at runtime, you
can define them in `config/runtime.exs`. Note that in this case, handlers are global for all instances of the plug,
unless declared at compile time like above.
Your `config/runtime.exs`:
import Config
config :bonny_plug, BonnyPlug.WebhookPlug
handlers: [MyApp.WebhookHandlers.FooResourceWebhookHandler]
Your `router.ex`:
post "/admission-review/validate", BonnyPlug.WebhookPlug,
webhook_type: :validating_webhook
# handlers set at compile time according to config
post "/admission-review/mutate", BonnyPlug.WebhookPlug,
webhook_type: :mutating_webhook,
handlers: [MyApp.WebhookHandlers.BarResourceWebhookHandler] # NOT overwritten at compile time!
"""
import Plug.Conn
alias BonnyPlug.AdmissionReview
alias BonnyPlug.AdmissionReview.Request
@api_version "admission.k8s.io/v1"
@kind "AdmissionReview"
@type webhook_type :: :validating_webhook | :mutating_webhook
def init(options) do
Keyword.put_new_lazy(options, :handlers, fn
-> Application.get_env(:bonny_plug, BonnyPlug.WebhookPlug)[:handlers]
end)
end
def call(%Plug.Conn{method: "POST"} = conn, opts) do
webhook_type = Keyword.fetch!(opts, :webhook_type)
handlers = Keyword.get(opts, :handlers, [])
case process(conn.body_params, webhook_type, handlers) do
{:ok, response_body} ->
conn
|> put_resp_content_type("application/json")
|> send_resp(200, response_body)
{:error, code, response_body} -> resp(conn, code, response_body)
end
end
def call(conn, _), do: send_resp(conn, 404, "Not Found")
@spec process(map(), atom(), Enum.t()) :: {:ok, binary()} | {:error, integer(), binary()}
def process(%{"apiVersion" => @api_version, "kind" => @kind, "request" => request}, webhook_type, handlers) do
response = request
|> AdmissionReview.create()
|> Request.allow()
|> (&Enum.reduce(handlers, &1, fn (handler, acc) -> Kernel.apply(handler, :process, [acc, webhook_type]) end)).()
|> Map.get(:response)
response_body = Jason.encode!(%{"apiVersion" => @api_version, "kind" => @kind, "response" => response})
{:ok, response_body}
end
def process(_, _, _), do: {:error, 400, "Unsupported Payload. This service expects a k8s admission review json document of apiVersion \"admission.k8s.io/v1\"."}
end
| 37.134831
| 162
| 0.702572
|
93bab2af285b870ccfbd019a954f15cfe5bbfbeb
| 1,912
|
exs
|
Elixir
|
samples/repat_n.exs
|
gomoripeti/benchee
|
bd5185bcfdc8320c237959505e63a89d31e044a9
|
[
"MIT"
] | 636
|
2016-06-06T07:58:36.000Z
|
2019-03-19T15:27:37.000Z
|
samples/repat_n.exs
|
gomoripeti/benchee
|
bd5185bcfdc8320c237959505e63a89d31e044a9
|
[
"MIT"
] | 198
|
2016-06-18T08:19:15.000Z
|
2019-03-19T15:32:37.000Z
|
samples/repat_n.exs
|
gomoripeti/benchee
|
bd5185bcfdc8320c237959505e63a89d31e044a9
|
[
"MIT"
] | 43
|
2016-06-08T08:04:30.000Z
|
2019-02-13T17:10:24.000Z
|
n = 1_000
range = 1..n
list = Enum.to_list(range)
fun = fn -> 0 end
Benchee.run(%{
"Enum.each (range)" => fn -> Enum.each(range, fn _ -> fun.() end) end,
"List comprehension (range)" => fn -> for _ <- range, do: fun.() end,
"Enum.each (list)" => fn -> Enum.each(list, fn _ -> fun.() end) end,
"List comprehension (list)" => fn -> for _ <- list, do: fun.() end,
"Recursion" => fn -> Benchee.Utility.RepeatN.repeat_n(fun, n) end
})
# Operating System: Linux
# CPU Information: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
# Number of Available Cores: 8
# Available memory: 15.61 GB
# Elixir 1.8.1
# Erlang 21.3.2
# Benchmark suite executing with the following configuration:
# warmup: 2 s
# time: 5 s
# memory time: 0 ns
# parallel: 1
# inputs: none specified
# Estimated total run time: 35 s
# Benchmarking Enum.each (list)...
# Benchmarking Enum.each (range)...
# Benchmarking List comprehension (list)...
# Benchmarking List comprehension (range)...
# Benchmarking Recursion...
# Name ips average deviation median 99th %
# Recursion 80.33 K 12.45 μs ±12.46% 12.37 μs 15.02 μs
# Enum.each (list) 45.83 K 21.82 μs ±19.54% 20.57 μs 34.33 μs
# List comprehension (list) 43.23 K 23.13 μs ±12.07% 22.72 μs 33.55 μs
# List comprehension (range) 35.26 K 28.36 μs ±10.99% 27.88 μs 36.29 μs
# Enum.each (range) 30.09 K 33.24 μs ±11.21% 32.83 μs 48.55 μs
# Comparison:
# Recursion 80.33 K
# Enum.each (list) 45.83 K - 1.75x slower +9.37 μs
# List comprehension (list) 43.23 K - 1.86x slower +10.69 μs
# List comprehension (range) 35.26 K - 2.28x slower +15.91 μs
# Enum.each (range) 30.09 K - 2.67x slower +20.79 μs
| 39.833333
| 98
| 0.5591
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.