README.md

# IDeviceDb

[![Hex](https://img.shields.io/hexpm/v/idevice_db.svg)](https://hex.pm/packages/idevice_db)
[![Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/idevice_db/)
[![License](https://img.shields.io/hexpm/l/idevice_db.svg)](https://github.com/ausimian/idevice_db/blob/main/LICENSE.md)
![github actions badge](https://github.com/ausimian/idevice_db/actions/workflows/build.yaml/badge.svg)

A database of Apple devices.

This package provides a simple API for querying a database of Apple devices.
The database is generated from [The Apple Wiki](https://theapplewiki.com/wiki/Models)
and is stored in the `priv` directory of the application.

When the application is loaded, the database is read from the priv directory and stored in
persistent terms. This means that the database is only read from disk once and is then
available in memory for the lifetime of the application.

## Examples
 
    iex> IDeviceDb.find_by_model("MWHG2")
    %{
      finish: "Gold",
      identifier: "iPhone12,5",
      models: ["MWHG2"],
      generation: "iPhone 11 Pro Max",
      internal_name: "D431AP",
      storage: "64 GB"
    }

## Generating the data

The `priv/devices.json` file may be regenerated by running `mix generate_db`.

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `idevice_db` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:idevice_db, "~> 1.0.0"}
  ]
end
```