diff --git a/app/DotsAPI/Fetcher/v2/AuthApiFetcher.php b/app/DotsAPI/Fetcher/v2/AuthApiFetcher.php new file mode 100644 index 0000000..e2f035d --- /dev/null +++ b/app/DotsAPI/Fetcher/v2/AuthApiFetcher.php @@ -0,0 +1,42 @@ +get( + $apiUrl, + [ + 'headers' => [ + 'Api-Auth-Token' => $apiAuthToken, + 'Api-Token' => $apiToken, + 'Api-Account-Token' => $apiAccountToken, + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', + ], + 'query' => [ + 'v'=> '2.0.0', + ], + ] + ); + + $data = json_decode($response->getBody()->getContents(), true); + + if($field == '') + return $data; + + return $data[$field]; + } +} diff --git a/app/DotsAPI/Fetcher/v2/AuthApiSender.php b/app/DotsAPI/Fetcher/v2/AuthApiSender.php new file mode 100644 index 0000000..aff9cdd --- /dev/null +++ b/app/DotsAPI/Fetcher/v2/AuthApiSender.php @@ -0,0 +1,44 @@ +post( + $apiUrl, + [ + GuzzleHttp\RequestOptions::JSON => $json, + 'headers' => [ + 'Api-Auth-Token' => $apiAuthToken, + 'Api-Token' => $apiToken, + 'Api-Account-Token' => $apiAccountToken, + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', + ], + 'query' => [ + 'v'=> '2.0.0', + ], + ] + ); + + $data = json_decode($response->getBody()->getContents(), true); + + if($field == '') + return $data; + + return $data[$field]; + } +}