示例#1
0
 /**
  * @param $uri
  * @param array $jsonParams
  * @param $user
  * @param $password
  * @return Response
  */
 public static function sendPostJsonWithAuth($uri, array $jsonParams = [], $user, $password)
 {
     $requestHelper = new RequestHelper();
     $guzzle = new Client();
     $httpClient = new HTTPClient($guzzle, $requestHelper);
     $httpHelper = new HttpHelper($httpClient);
     $response = $httpHelper->sendPostJsonWithAuth($uri, $jsonParams, $user, $password);
     return $response;
 }
示例#2
0
 private function createRepoBitBucket()
 {
     $response = new \Padosoft\HTTPClient\Response();
     try {
         $httphelper = new HttpHelper(new HTTPClient(new Client(), new RequestHelper()));
         $response = $httphelper->sendPostJsonWithAuth("https://api.bitbucket.org/2.0/repositories/" . $this->workbenchSettings->requested['organization']['valore'] . "/" . $this->workbenchSettings->requested['packagename']['valore'], ['scm' => 'git', 'is_private' => 'true', 'name' => $this->workbenchSettings->requested["packagename"]["valore"]], $this->workbenchSettings->requested["user"]["valore"], $this->workbenchSettings->requested["password"]["valore"]);
         $this->info("Created repo https://bitbucket.org/" . $this->workbenchSettings->requested['organization']["valore"] . "/" . $this->workbenchSettings->requested["packagename"]["valore"]);
         if ($response->status_code == 400) {
             $this->error($response->body);
             exit;
         }
     } catch (\Exception $ex) {
         $this->error($ex->getMessage());
         exit;
     }
 }