# This file is auto-generated by `mix graph.gen.schema`. Do not edit manually. defmodule GraphApi.Schema.DriveItem do @moduledoc """ Auto-generated schema for `microsoft.graph.driveItem`. """ defstruct [ :id, :name, :size, :web_url, :created_date_time, :last_modified_date_time, :file, :folder, :parent_reference ] @type t :: %__MODULE__{ id: String.t() | nil, name: String.t() | nil, size: integer() | nil, web_url: String.t() | nil, created_date_time: String.t() | nil, last_modified_date_time: String.t() | nil, file: GraphApi.Schema.File.t() | nil, folder: GraphApi.Schema.Folder.t() | nil, parent_reference: GraphApi.Schema.ItemReference.t() | nil } @field_mapping %{ {"id", :id}, {"name", :name}, {"size", :size}, {"webUrl", :web_url}, {"createdDateTime", :created_date_time}, {"lastModifiedDateTime", :last_modified_date_time}, {"file", :file}, {"folder", :folder}, {"parentReference", :parent_reference} } @field_names [ "id", "name", "size", "webUrl", "createdDateTime", "lastModifiedDateTime", "file", "folder", "parentReference" ] @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"], size: map["size"], web_url: map["webUrl"], created_date_time: map["createdDateTime"], last_modified_date_time: map["lastModifiedDateTime"], file: case map["file"] do nil -> nil val -> GraphApi.Schema.File.from_map(val) end, folder: case map["folder"] do nil -> nil val -> GraphApi.Schema.Folder.from_map(val) end, parent_reference: case map["parentReference"] do nil -> nil val -> GraphApi.Schema.ItemReference.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}, {"size", struct.size}, {"webUrl", struct.web_url}, {"createdDateTime", struct.created_date_time}, {"lastModifiedDateTime", struct.last_modified_date_time}, {"file", case struct.file do nil -> nil val -> GraphApi.Schema.File.to_map(val) end}, {"folder", case struct.folder do nil -> nil val -> GraphApi.Schema.Folder.to_map(val) end}, {"parentReference", case struct.parent_reference do nil -> nil val -> GraphApi.Schema.ItemReference.to_map(val) end} ] |> Enum.reject(fn {_k, v} -> is_nil(v) end) |> Map.new() end end