From 2935ee89cdd5076c61d0611b3b3ae0b701db881a Mon Sep 17 00:00:00 2001 From: Jonathan Henrique <31408451+jhowbhz@users.noreply.github.com> Date: Wed, 28 Feb 2024 23:35:33 -0300 Subject: [PATCH] add new endpoints --- src/Service.php | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/Service.php b/src/Service.php index d68e978..954ecd1 100644 --- a/src/Service.php +++ b/src/Service.php @@ -275,4 +275,66 @@ public static function CEP(String $action = '', Array $data = []) { } + public static function HoliDays(String $action = '', Array $data = []) { + + try { + + $base_uri = "https://gateway.apibrasil.io/api/v2/holidays/".$action; + $method = $data['method'] ?? 'POST'; + + $headers = [ + "Content-Type" => "application/json", + "Accept" => "application/json", + "Authorization" => "Bearer ".$data['Bearer'], + ]; + + if (isset($data['DeviceToken'])) { + $headers['DeviceToken'] = $data['DeviceToken']; + } + + $body = $data['body'] ?? []; + + $response = self::defaultRequest($method, $base_uri, $action, $headers, $body); + return $response; + + } catch (ClientException $e) { + + $response = $e->getResponse(); + return json_decode((string)($response->getBody()->getContents())); + + } + + } + + public static function DDD(String $action = '', Array $data = []) { + + try { + + $base_uri = "https://gateway.apibrasil.io/api/v2/ddd/".$action; + $method = $data['method'] ?? 'POST'; + + $headers = [ + "Content-Type" => "application/json", + "Accept" => "application/json", + "Authorization" => "Bearer ".$data['Bearer'], + ]; + + if (isset($data['DeviceToken'])) { + $headers['DeviceToken'] = $data['DeviceToken']; + } + + $body = $data['body'] ?? []; + + $response = self::defaultRequest($method, $base_uri, $action, $headers, $body); + return $response; + + } catch (ClientException $e) { + + $response = $e->getResponse(); + return json_decode((string)($response->getBody()->getContents())); + + } + + } + }