Current section
Files
Jump to
Current section
Files
lib/graph_api/schema/assigned_license.ex
# This file is auto-generated by `mix graph.gen.schema`. Do not edit manually.
defmodule GraphApi.Schema.AssignedLicense do
@moduledoc """
Auto-generated schema for `microsoft.graph.assignedLicense`.
"""
defstruct [:disabled_plans, :sku_id]
@type t :: %__MODULE__{
disabled_plans: [String.t()] | nil,
sku_id: String.t() | nil
}
@field_mapping %{
{"disabledPlans", :disabled_plans},
{"skuId", :sku_id}
}
@field_names [
"disabledPlans",
"skuId"
]
@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__{
disabled_plans: map["disabledPlans"],
sku_id: map["skuId"]
}
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
[
{"disabledPlans", struct.disabled_plans},
{"skuId", struct.sku_id}
]
|> Enum.reject(fn {_k, v} -> is_nil(v) end)
|> Map.new()
end
end