@@ -275,4 +275,66 @@ public static function CEP(String $action = '', Array $data = []) {
275
275
276
276
}
277
277
278
+ public static function HoliDays (String $ action = '' , Array $ data = []) {
279
+
280
+ try {
281
+
282
+ $ base_uri = "https://gateway.apibrasil.io/api/v2/holidays/ " .$ action ;
283
+ $ method = $ data ['method ' ] ?? 'POST ' ;
284
+
285
+ $ headers = [
286
+ "Content-Type " => "application/json " ,
287
+ "Accept " => "application/json " ,
288
+ "Authorization " => "Bearer " .$ data ['Bearer ' ],
289
+ ];
290
+
291
+ if (isset ($ data ['DeviceToken ' ])) {
292
+ $ headers ['DeviceToken ' ] = $ data ['DeviceToken ' ];
293
+ }
294
+
295
+ $ body = $ data ['body ' ] ?? [];
296
+
297
+ $ response = self ::defaultRequest ($ method , $ base_uri , $ action , $ headers , $ body );
298
+ return $ response ;
299
+
300
+ } catch (ClientException $ e ) {
301
+
302
+ $ response = $ e ->getResponse ();
303
+ return json_decode ((string )($ response ->getBody ()->getContents ()));
304
+
305
+ }
306
+
307
+ }
308
+
309
+ public static function DDD (String $ action = '' , Array $ data = []) {
310
+
311
+ try {
312
+
313
+ $ base_uri = "https://gateway.apibrasil.io/api/v2/ddd/ " .$ action ;
314
+ $ method = $ data ['method ' ] ?? 'POST ' ;
315
+
316
+ $ headers = [
317
+ "Content-Type " => "application/json " ,
318
+ "Accept " => "application/json " ,
319
+ "Authorization " => "Bearer " .$ data ['Bearer ' ],
320
+ ];
321
+
322
+ if (isset ($ data ['DeviceToken ' ])) {
323
+ $ headers ['DeviceToken ' ] = $ data ['DeviceToken ' ];
324
+ }
325
+
326
+ $ body = $ data ['body ' ] ?? [];
327
+
328
+ $ response = self ::defaultRequest ($ method , $ base_uri , $ action , $ headers , $ body );
329
+ return $ response ;
330
+
331
+ } catch (ClientException $ e ) {
332
+
333
+ $ response = $ e ->getResponse ();
334
+ return json_decode ((string )($ response ->getBody ()->getContents ()));
335
+
336
+ }
337
+
338
+ }
339
+
278
340
}
0 commit comments