Packages

Elixir client for the Microsoft Graph API

Current section

Files

Jump to
keen_microsoft_graphapi lib graph_api schema quota.ex
Raw

lib/graph_api/schema/quota.ex

# This file is auto-generated by `mix graph.gen.schema`. Do not edit manually.
defmodule GraphApi.Schema.Quota do
@moduledoc """
Auto-generated schema for `microsoft.graph.quota`.
"""
defstruct [:total, :used, :remaining, :state]
@type t :: %__MODULE__{
total: integer() | nil,
used: integer() | nil,
remaining: integer() | nil,
state: String.t() | nil
}
@field_mapping %{
{"total", :total},
{"used", :used},
{"remaining", :remaining},
{"state", :state}
}
@field_names [
"total",
"used",
"remaining",
"state"
]
@doc "Mapping from camelCase API field names to snake_case struct atoms."
@spec __field_mapping__() :: %{String.t() => atom()}
def __field_mapping__, do: @field_mapping
@doc "List of camelCase API field names (for OData `$select`)."
@spec __field_names__() :: [String.t()]
def __field_names__, do: @field_names
@doc "Converts a camelCase string-key map (API response) into this struct."
@spec from_map(map()) :: t()
def from_map(map) when is_map(map) do
%__MODULE__{
total: map["total"],
used: map["used"],
remaining: map["remaining"],
state: map["state"]
}
end
@doc "Converts this struct to a camelCase string-key map. Nil fields are omitted."
@spec to_map(t()) :: map()
def to_map(%__MODULE__{} = struct) do
[
{"total", struct.total},
{"used", struct.used},
{"remaining", struct.remaining},
{"state", struct.state}
]
|> Enum.reject(fn {_k, v} -> is_nil(v) end)
|> Map.new()
end
end