# DeviceAtlas Device Detection API Upgrade # This document is intended for users of APIs prior to version 2.2.0. It has two main sections: 1. Why upgrade? 2. Upgrading from 2.1.2 to 2.2.0 ## Why upgrade? ## Version 2.2.0 of the API provides an new additional API to provide Carrier Identification intelligence. In addition, this new version provide a precise configuration to address particular use cases. It is a recommended upgrade for all users. ## Upgrading from 2.1.2 to 2.2.0 ## The 2.2.0 API is a drop-in replacement, with minimal changes, for the 2.1.2 APIs. It should not cause any compatibility issues except for the cases described below. To upgrade to version 2.1 replace the current folder containing the API files, and extract the new version in a new folder with the name of the API files before renaming. ## API behavior changes ## API changes between 2.1.2 and 2.2.0 APIs are as follows: ### Namespace change ### From: ```go import "deviceatlas" // version 2.1.2 ``` To: ```go import "deviceatlas/device" // version 2.2.0 ``` ### New function to provide DaGo configuration ### Create a new `DaGo` instance with a custom configuration using `NewWithConfig()` function. Any change made to the config without called `Config()` will no longer have any effect. Please see the [Device Detection API Config readme file](README.DeviceApi-Config.html) for more information. ### Free function ### The `Free` method/function is to be called to clear all the api resources once. The garbage collector, if triggered, will call it implicitly, however it is greatly recommended to proceed explicitly in this fashion : ` ... da := device.New() da.LoadDataFromFile(<JSON path>) defer da.Free() ... ` ### Renamed JSONMeta function ### From: ```go // version 2.1.2 func JsonMeta(f *DaGo) (DaJsonMeta, error) { ... } ``` To: ```go // version 2.2.0 func (f *DaGo) JSONMeta() (DaJSONMeta, error) { ... } ``` ### Restructured DaJSONMeta type ### From: ```go // version 2.1.2 type DaJsonMeta struct { Version string Dcreation time.Time Revision int } ``` To: ```go // version 2.2.0 type DaJSONMeta struct { Version string Dcreation time.Time Revision int } ``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _ Copyright (c) DeviceAtlas 2022. All Rights Reserved. _ https://deviceatlas.com <!-- HTML+JS for document formatting when opened in browser --> <div class="btn-group" id="main-menu" style="float:right"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Menu<span class="caret"></span></a><ul class="dropdown-menu"><li><a href="README.html">Main</a></li><li><a href="README.DeviceApi.html">Building dependencies and API</a></li><li><a href="README.DeviceApi-Web.html">Device Detection for Web</a></li><li><a href="README.DeviceApi-Apps.html">Device Detection for Apps</a></li><li><a href="./ApiDocs/device.html">Device API Docs</a></li><li class="divider"></li><li><a href="README.DeviceApi-Config.html">Device Detection API Config</a></li><li class="disabled"><a href="README.Upgrade.html">Device Detection API Upgrade</a></li><li class="divider"></li><li><a href="README.CarrierApi.html">Carrier Identification API</a></li><li><a href="./ApiDocs/carrier.html">Carrier API Docs</a></li><li class="divider"></li><li><a href="README.CarrierApi-Config.html">Carrier Detection API Config</a></li></ul></div>