# This file is auto-generated by `mix graph.gen.schema`. Do not edit manually. defmodule GraphApi.Schema.Drive do @moduledoc """ Auto-generated schema for `microsoft.graph.drive`. """ defstruct [:id, :name, :drive_type, :web_url, :owner, :quota] @type t :: %__MODULE__{ id: String.t() | nil, name: String.t() | nil, drive_type: String.t() | nil, web_url: String.t() | nil, owner: GraphApi.Schema.IdentitySet.t() | nil, quota: GraphApi.Schema.Quota.t() | nil } @field_mapping %{ {"id", :id}, {"name", :name}, {"driveType", :drive_type}, {"webUrl", :web_url}, {"owner", :owner}, {"quota", :quota} } @field_names [ "id", "name", "driveType", "webUrl", "owner", "quota" ] @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__{ id: map["id"], name: map["name"], drive_type: map["driveType"], web_url: map["webUrl"], owner: case map["owner"] do nil -> nil val -> GraphApi.Schema.IdentitySet.from_map(val) end, quota: case map["quota"] do nil -> nil val -> GraphApi.Schema.Quota.from_map(val) end } 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 [ {"id", struct.id}, {"name", struct.name}, {"driveType", struct.drive_type}, {"webUrl", struct.web_url}, {"owner", case struct.owner do nil -> nil val -> GraphApi.Schema.IdentitySet.to_map(val) end}, {"quota", case struct.quota do nil -> nil val -> GraphApi.Schema.Quota.to_map(val) end} ] |> Enum.reject(fn {_k, v} -> is_nil(v) end) |> Map.new() end end