diff --git a/README.md b/README.md
index 0c21fa7..3e2900c 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Api Evolution: [Evolution-api](https://doc.evolution-api.com/v2/)
-SDK version: 2.0.5
+SDK version: 2.0.6
PHP Version: >= 8.2
## Funções disponíveis
diff --git a/src/Api/Evolution/Device.php b/src/Api/Evolution/Device.php
index d47729d..a80bac5 100644
--- a/src/Api/Evolution/Device.php
+++ b/src/Api/Evolution/Device.php
@@ -489,6 +489,53 @@ public static function isConnected(): bool
}
+ public function exist(){
+ try {
+
+ if (ExceptionError::$error) {
+ return NULL;
+ }
+
+ $curl = curl_init();
+
+ curl_setopt_array($curl, array(
+ CURLOPT_URL => rtrim(self::$endpoint, '/') . '/instance/connectionState/' . trim(self::$name_instance),
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_ENCODING => '',
+ CURLOPT_MAXREDIRS => 10,
+ CURLOPT_TIMEOUT => 0,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+ CURLOPT_CUSTOMREQUEST => 'DELETE',
+ CURLOPT_HTTPHEADER => array(
+ 'apikey: ' . trim(self::$instance)
+ ),
+ )
+ );
+
+ $response = curl_exec($curl);
+ $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
+ curl_close($curl);
+
+ try {
+
+ if($httpCode == 404){
+ return false;
+ }
+
+ return true;
+
+ } catch (\Exception $e) {
+ ExceptionError::setError(500, json_encode(['type' => 'Exception', 'class' => 'Api\Evolution\Device', 'method' => 'exist', 'message' => $e->getMessage()]));
+ return false;
+ }
+
+ } catch (\Exception $e) {
+ ExceptionError::setError(500, json_encode(['type' => 'Exception', 'class' => 'Api\Evolution\Device', 'method' => 'exist', 'message' => $e->getMessage()]));
+ return false;
+ }
+ }
+
public static function logout()
{
diff --git a/src/Api/Evolution2/Device.php b/src/Api/Evolution2/Device.php
index 46e0932..04e2596 100644
--- a/src/Api/Evolution2/Device.php
+++ b/src/Api/Evolution2/Device.php
@@ -565,6 +565,53 @@ public static function delete()
}
}
+ public function exist(){
+ try {
+
+ if (ExceptionError::$error) {
+ return NULL;
+ }
+
+ $curl = curl_init();
+
+ curl_setopt_array($curl, array(
+ CURLOPT_URL => rtrim(self::$endpoint, '/') . '/instance/connectionState/' . trim(self::$name_instance),
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_ENCODING => '',
+ CURLOPT_MAXREDIRS => 10,
+ CURLOPT_TIMEOUT => 0,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+ CURLOPT_CUSTOMREQUEST => 'DELETE',
+ CURLOPT_HTTPHEADER => array(
+ 'apikey: ' . trim(self::$instance)
+ ),
+ )
+ );
+
+ $response = curl_exec($curl);
+ $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
+ curl_close($curl);
+
+ try {
+
+ if($httpCode == 404){
+ return false;
+ }
+
+ return true;
+
+ } catch (\Exception $e) {
+ ExceptionError::setError(500, json_encode(['type' => 'Exception', 'class' => 'Api\Evolution\Device', 'method' => 'exist', 'message' => $e->getMessage()]));
+ return false;
+ }
+
+ } catch (\Exception $e) {
+ ExceptionError::setError(500, json_encode(['type' => 'Exception', 'class' => 'Api\Evolution\Device', 'method' => 'exist', 'message' => $e->getMessage()]));
+ return false;
+ }
+ }
+
public static function logout()
{