Packages

Elixir client for the Microsoft Graph API

Current section

Files

Jump to
keen_microsoft_graphapi lib graph_api schema beta item_reference.ex
Raw

lib/graph_api/schema/beta/item_reference.ex

# This file is auto-generated by `mix graph.gen.schema`. Do not edit manually.
defmodule GraphApi.Schema.Beta.ItemReference do
@moduledoc """
Auto-generated schema for `microsoft.graph.itemReference`.
"""
defstruct [:drive_id, :drive_type, :id, :name, :path]
@type t :: %__MODULE__{
drive_id: String.t() | nil,
drive_type: String.t() | nil,
id: String.t() | nil,
name: String.t() | nil,
path: String.t() | nil
}
@field_mapping %{
{"driveId", :drive_id},
{"driveType", :drive_type},
{"id", :id},
{"name", :name},
{"path", :path}
}
@field_names [
"driveId",
"driveType",
"id",
"name",
"path"
]
@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__{
drive_id: map["driveId"],
drive_type: map["driveType"],
id: map["id"],
name: map["name"],
path: map["path"]
}
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
[
{"driveId", struct.drive_id},
{"driveType", struct.drive_type},
{"id", struct.id},
{"name", struct.name},
{"path", struct.path}
]
|> Enum.reject(fn {_k, v} -> is_nil(v) end)
|> Map.new()
end
end