Skip to content

Commit bc77cd7

Browse files
authored
fix get plans and plan me
1 parent 6b2b614 commit bc77cd7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/Service.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,38 @@ public static function Auth(String $action = '', Array $data = []) {
6060

6161
}
6262

63+
public static function Plan(String $action = '', Array $data = []) {
64+
65+
try {
66+
67+
$base_uri = "https://gateway.apibrasil.io/api/v2/plans/";
68+
$method = $data['method'] ?? 'POST';
69+
$me = $action == "me" ? true : false;
70+
71+
if($me){
72+
$base_uri = "https://gateway.apibrasil.io/api/v2/plan/";
73+
}
74+
75+
$headers = [
76+
"Content-Type" => "application/json",
77+
"Accept" => "application/json",
78+
"Authorization" => "Bearer ".$data['Bearer'],
79+
];
80+
81+
$body = $data['body'] ?? [];
82+
83+
$response = self::defaultRequest($method, $base_uri, $action, $headers, $body);
84+
return $response;
85+
86+
} catch (ClientException $e) {
87+
88+
$response = $e->getResponse();
89+
return json_decode((string)($response->getBody()->getContents()));
90+
91+
}
92+
93+
}
94+
6395
public static function Profile(String $action = '', Array $data = []) {
6496

6597
try {

0 commit comments

Comments
 (0)