Skip to content

Commit

Permalink
user
Browse files Browse the repository at this point in the history
  • Loading branch information
efcasado committed May 12, 2024
1 parent e836eac commit b583e8e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
15 changes: 0 additions & 15 deletions lib/uof/api/mappings/bookmaker_details.ex

This file was deleted.

34 changes: 32 additions & 2 deletions lib/uof/api/users.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ defmodule UOF.API.Users do
@moduledoc """
API used for administrative purposes.
"""
alias UOF.API.Utils.HTTP
use Ecto.Schema
import Ecto.Changeset
import UOF.API.EctoHelpers

@doc """
Get information about the token being used, including information such as
Expand All @@ -11,6 +13,34 @@ defmodule UOF.API.Users do
def whoami do
endpoint = ["users", "whoami.xml"]

HTTP.get(%UOF.API.Mappings.BookmakerDetails{}, endpoint)
case UOF.API.get("/users/whoami.xml") do
{:ok, %_{status: 200, body: resp}} ->
resp

# |> Map.get("betstop_reasons_descriptions")
# |> Map.get("betstop_reason")
# |> Enum.map(fn x ->
# {:ok, x} = changeset(x)
# x
# end)

{:error, _} = error ->
error
end
end

@primary_key false

embedded_schema do
field :expire_at, :string
field :bookmaker_id, :string
field :virtual_host, :string
end

def changeset(model, params) do
params = sanitize(params)

model
|> cast(params, [:expire_at, :bookmaker_id, :virtual_host])
end
end

0 comments on commit b583e8e

Please sign in to comment.