Current section
Files
Jump to
Current section
Files
lib/fast_postman_collection/generate_collection/structs/query.ex
defmodule FastPostmanCollection.GenerateCollection.Structs.Query do
alias FastPostmanCollection.CollectDataItemParams
defstruct key: "", value: "", disabled: false, description: nil
def generate(doc_params = %CollectDataItemParams{}) do
if is_map(doc_params.params) do
doc_params.params
|> Enum.map(fn {key, value} ->
if is_map(value) do
%__MODULE__{
key: key,
value: value[:value],
disabled: value[:disabled],
description: value[:description]
}
else
%__MODULE__{
key: key,
value: value |> to_string()
}
end
end)
end
end
end