当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::throwExceptionIfNullOrBlank方法代码示例

本文整理汇总了PHP中Util::throwExceptionIfNullOrBlank方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::throwExceptionIfNullOrBlank方法的具体用法?PHP Util::throwExceptionIfNullOrBlank怎么用?PHP Util::throwExceptionIfNullOrBlank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Util的用法示例。


在下文中一共展示了Util::throwExceptionIfNullOrBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createApp

 function createApp($appName, $orgName)
 {
     Util::throwExceptionIfNullOrBlank($appName, "App Name");
     Util::throwExceptionIfNullOrBlank($orgName, "orgName");
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = array();
         $params['apiKey'] = $this->apiKey;
         $params['version'] = $this->version;
         date_default_timezone_set('UTC');
         $params['timeStamp'] = date("Y-m-d\\TG:i:s") . substr((string) microtime(), 1, 4) . "Z";
         $params['App Name'] = $appName;
         $params['orgName'] = $orgName;
         $signature = urlencode($objUtil->sign($params));
         //die();
         $body = null;
         $body = '{"app42":{"app":}}';
         $params['body'] = $body;
         $params['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $this->url = $this->url;
         $response = RestClient::post($this->url, $params, null, null, $contentType, $accept, $body);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $response;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:30,代码来源:App.php

示例2: removeAllAttributes

 /**
  * Removes all the attributes for a given session id
  *
  * @param sessionId
  *            - The session id for which the attributes has to be removed
  *
  * @return App42Response if removed successfully
  */
 function removeAllAttributes($sessionId)
 {
     Util::throwExceptionIfNullOrBlank($sessionId, "session Id");
     $encodedSessionId = Util::encodeParams($sessionId);
     $responseObj = new App42Response();
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $signParams['sessionId'] = $sessionId;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/id/" . $encodedSessionId;
         $response = RestClient::delete($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $sessionResponseObj = new SessionResponseBuilder();
         $sessionObj = $sessionResponseObj->buildResponse($response->getResponse());
         $responseObj->setStrResponse($sessionObj);
         $responseObj->setResponseSuccess(true);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $responseObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:41,代码来源:SessionService.php

示例3: isActive

 function isActive($testName)
 {
     Util::throwExceptionIfNullOrBlank($testName, "testName");
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $signParams['testName'] = $testName;
         $headerParams = array_merge($signParams, $metaHeaders);
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/isActive/" . $testName;
         $response = RestClient::get($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $abTestRespObj = new ABTestResponseBuilder();
         $abTestObj = $abTestRespObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $abTestObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:29,代码来源:ABTestService.php

示例4: getCountByQuery

 function getCountByQuery($dbName, $collectionName, $query)
 {
     Util::throwExceptionIfNullOrBlank($dbName, "DataBase Name");
     Util::throwExceptionIfNullOrBlank($collectionName, "Collection Name");
     Util::throwExceptionIfNullOrBlank($query, "query");
     $encodedDbName = Util::encodeParams($dbName);
     $encodedCollectionName = Util::encodeParams($collectionName);
     $responseObj = new App42Response();
     $objUtil = new Util($this->apiKey, $this->secretKey);
     $queryObject = null;
     if ($query instanceof JSONObject) {
         $queryObject = array();
         array_push($queryObject, $query);
     } else {
         $queryObject = $query;
     }
     try {
         $params = null;
         $storageObj = new App42Response();
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $signParams['dbName'] = $dbName;
         $signParams['collectionName'] = $collectionName;
         $signParams['jsonQuery'] = json_encode($queryObject);
         $queryParams['jsonQuery'] = json_encode($queryObject);
         $params = array_merge($queryParams, $signParams);
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/findDocsByQuery" . "/dbName/" . $encodedDbName . "/collectionName/" . $encodedCollectionName;
         $response = RestClient::get($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $storageResponseObj = new StorageResponseBuilder();
         $storageObj = $storageResponseObj->buildResponse($response->getResponse());
         $totalRecord = $storageObj->getRecordCount();
         $body = '{"app42":{"response":{"totalRecords":"' . $totalRecord . '"}}}';
         $responseObj->setStrResponse($body);
         $responseObj->setResponseSuccess(true);
         $responseObj->setTotalRecords($totalRecord);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $responseObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:51,代码来源:StorageService.php

示例5: deleteGeoPoints

 /**
  * Delete the specified Geo points from Cloud.
  *
  * @param storageName
  *            - Unique handler for storage name
  *
  * @return App42Response object containing the name of the storage that has
  *         been deleted
  *
  * @throws App42Exception
  */
 function deleteGeoPoints($geoStorageName, $geoPointsList)
 {
     Util::throwExceptionIfNullOrBlank($geoStorageName, "Geo Storage Name");
     Util::throwExceptionIfNullOrBlank($geoPointsList, "Geo Points List");
     $encodedStorageName = Util::encodeParams($geoStorageName);
     $responseObj = new App42Response();
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         if (is_array($geoPointsList)) {
             $string = '{"app42":{ "geo": {"storage":{"points": { "point": ' . json_encode($geoPointsList) . '}}}}}';
         } else {
             $string = '{"app42":{ "geo": {"storage":{"points": { "point": "' . $geoPointsList . '"}}}}}';
         }
         $signParams['geoPoints'] = $string;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/points/" . $encodedStorageName;
         $response = RestClient::delete($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $geoResponseObj = new GeoResponseBuilder();
         $geoObj = $geoResponseObj->buildResponse($response->getResponse());
         $responseObj->setStrResponse($geoObj);
         $responseObj->setResponseSuccess(true);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $responseObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:50,代码来源:GeoService.php

示例6: addOrUpdatePreference

 /**
  * Add or Update preference list on the cloud.
  *
  * @param preferenceDataList
  *            - List of PreferenceData which contains customerId, itemId,
  *            preference
  *
  * @return App42Response object
  */
 function addOrUpdatePreference($preferenceDataList)
 {
     Util::throwExceptionIfNullOrBlank($preferenceDataList, "Preference Data List");
     $responseObj = new App42Response();
     $objUtil = new Util($this->apiKey, $this->secretKey);
     $dataValue = array();
     $preferenceData = new PreferenceData();
     if (is_array($preferenceDataList)) {
         foreach ($preferenceDataList as $arrayValue) {
             $userId = $arrayValue->getUserId();
             $itemId = $arrayValue->getItemId();
             $preference = $arrayValue->getPreference();
             $array = array("UserId" => $userId, "itemId" => $itemId, "preference" => $preference);
             array_push($dataValue, $array);
         }
     } else {
         $userId = $preferenceDataList->getUserId();
         $itemId = $preferenceDataList->getItemId();
         $preference = $preferenceDataList->getPreference();
         $array = array("UserId" => $userId, "itemId" => $itemId, "preference" => $preference);
         array_push($dataValue, $array);
     }
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $body = null;
         //$body = '{"app42":{"preferences":{"preference":"' . $preferenceDataList->getUserId() . '","itemId":"' . $preferenceDataList->getItemId() . '","preference":"' . $preferenceDataList->getPreference() . '"}}}}';
         $body = '{"app42":{"preferences":{"preference":' . json_encode($dataValue) . '}}}';
         $signParams['body'] = $body;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/addOrUpdatePreference";
         $response = RestClient::post($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);
         $responseObj->setStrResponse($response);
         $responseObj->setResponseSuccess(true);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $responseObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:59,代码来源:RecommenderService.php

示例7: createUserWithProfile

 function createUserWithProfile($uName, $pwd, $emailAddress, Profile $profile)
 {
     Util::throwExceptionIfNullOrBlank($uName, "User Name");
     Util::throwExceptionIfNullOrBlank($pwd, "Password");
     Util::throwExceptionIfNullOrBlank($emailAddress, "Email Address");
     Util::throwExceptionIfEmailNotValid($emailAddress, "Email Address");
     Util::throwExceptionIfNullOrBlank($profile, "Profile Data");
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $body = null;
         $body = '{"app42":{"user":{"userName":"' . $uName . '","password":"' . $pwd . '","email":"' . $emailAddress . '", "profileData":{"firstName":"' . $profile->getFirstName() . '","lastName":"' . $profile->getLastName() . '","sex":"' . $profile->getSex() . '","mobile":"' . $profile->getMobile() . '","line1":"' . $profile->getLine1() . '","line2":"' . $profile->getLine2() . '","city":"' . $profile->getCity() . '","state":"' . $profile->getState() . '","country":"' . $profile->getCountry() . '","pincode":"' . $profile->getPincode() . '","homeLandLine":"' . $profile->getHomeLandLine() . '","officeLandLine":"' . $profile->getOfficeLandLine() . '","dateOfBirth":"' . (date("Y-m-d\\TG:i:s", strtotime($profile->getDateOfBirth())) . substr((string) microtime(), 1, 4) . "Z") . '"}}}}';
         $signParams['body'] = $body;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         //CONTENT_TYPE;
         $accept = $this->accept;
         //ACCEPT;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/userwithprofile";
         $response = RestClient::post($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);
         $userResponseObj = new UserResponseBuilder();
         $userObj = $userResponseObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $userObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:37,代码来源:UserService.php

示例8: deductScore

 /**
  * Deducts the score from users account for a particular Game
  *
  * @param gameName
  *            - Name of the game for which scores have to be deducted
  * @param gameUserName
  *            - The user for whom scores have to be deducted
  * @param gameScore
  *            - The scores that have to be deducted
  *
  * @return Game object containing the scores that has been deducted
  */
 function deductScore($gameName, $gameUserName, $gameScore)
 {
     Util::throwExceptionIfNullOrBlank($gameName, "Game Name");
     Util::throwExceptionIfNullOrBlank($gameUserName, "User Name");
     Util::throwExceptionIfNullOrBlank($gameScore, "Score");
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $body = null;
         $body = '{"app42":{"game":{"name":"' . $gameName . '", "scores":{"score":{"userName":"' . $gameUserName . '","value":"' . $gameScore . '"}}}}}';
         $signParams['body'] = $body;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/deduct";
         $response = RestClient::post($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);
         $gameResponseObj = new GameResponseBuilder();
         $gameObj = $gameResponseObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $gameObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:45,代码来源:ScoreService.php

示例9: uploadFileForFriends

 function uploadFileForFriends($name, $userName, $filePath, $fileType, $description)
 {
     Util::throwExceptionIfNullOrBlank($name, "File Name");
     Util::throwExceptionIfNullOrBlank($userName, "User Name");
     Util::throwExceptionIfNullOrBlank($filePath, "FilePath");
     Util::throwExceptionIfNullOrBlank($fileType, "UploadFileType");
     Util::throwExceptionIfNullOrBlank($description, "Description");
     $encodedUserName = Util::encodeParams($userName);
     $objUtil = new Util($this->apiKey, $this->secretKey);
     //$file = fopen($filePath, r);
     if (!file_exists($filePath)) {
         throw new App42Exception("The file with the name '{$filePath}' not found ");
     }
     $body = null;
     try {
         $params = null;
         $uploadTypeObj = new UploadFileType();
         if ($uploadTypeObj->isAvailable($fileType) == "null") {
             throw new App42Exception("The file with  type '{$fileType}' does not Exist ");
         }
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $postParams = array();
         $postParams['name'] = $name;
         $postParams['userName'] = $userName;
         $postParams['type'] = $fileType;
         $postParams['description'] = $description;
         $params = array_merge($postParams, $signParams);
         $signature = urlencode($objUtil->sign($params));
         //die();
         $params['uploadFile'] = "@" . $filePath;
         $headerParams['signature'] = $signature;
         //CONTENT_TYPE == "multipart/form-data"
         $contentType = "multipart/form-data";
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/" . "friendsAll/" . $encodedUserName;
         $response = RestClient::post($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);
         $uploadResponseObj = new UploadResponseBuilder();
         $uploadObj = $uploadResponseObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $uploadObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:50,代码来源:UploadService.php

示例10: getUsersWithScoreRange

 function getUsersWithScoreRange($gameName, $minScore, $maxScore)
 {
     Util::throwExceptionIfNullOrBlank($gameName, "Game Name");
     $encodedGameName = Util::encodeParams($gameName);
     $encodedMinScore = Util::encodeParams($minScore);
     $encodedMaxScore = Util::encodeParams($maxScore);
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $signParams['name'] = $gameName;
         $signParams['minScore'] = $minScore;
         $signParams['maxScore'] = $maxScore;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/" . $encodedGameName . "/range/" . $minScore . "/" . $maxScore;
         $response = RestClient::get($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $gameResponseObj = new GameResponseBuilder();
         $gameObj = $gameResponseObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $gameObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:34,代码来源:ScoreBoardService.php

示例11: updatePhoto

 function updatePhoto($userName, $albumName, $photoName, $photoDescription, $path)
 {
     Util::throwExceptionIfNullOrBlank($userName, "User Name");
     Util::throwExceptionIfNullOrBlank($albumName, "Album Name");
     Util::throwExceptionIfNullOrBlank($photoName, "Photo Name");
     Util::throwExceptionIfNullOrBlank($photoDescription, "Description");
     Util::throwExceptionIfNullOrBlank($path, "Path");
     Util::throwExceptionIfNotValidImageExtension($path, "Photo Path");
     $encodedUserName = Util::encodeParams($userName);
     $objUtil = new Util($this->apiKey, $this->secretKey);
     if (!file_exists($path)) {
         throw new App42Exception("File Not Found");
     }
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $postParams = array();
         $postParams['userName'] = $userName;
         $postParams['albumName'] = $albumName;
         $postParams['name'] = $photoName;
         $postParams['description'] = $photoDescription;
         $params = array_merge($postParams, $signParams);
         $signature = urlencode($objUtil->sign($params));
         //die();
         $params['imageFile'] = "@" . $path;
         $headerParams['signature'] = $signature;
         $contentType = "multipart/form-data";
         $body = null;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/update/" . $encodedUserName;
         $response = RestClient::post($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);
         $photoResponseObj = new AlbumResponseBuilder();
         $photoObj = $photoResponseObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $photoObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:45,代码来源:PhotoService.php

示例12: sendMail

 /**
  * This Service is used to send Emails. This service can be used by app to send mail to one or multiple recipients.
  *
  * @params sendTo
  *            - The email ids to which the email has to be sent. Email can
  *            be sent to multiple email ids. Multiple email ids can be
  *            passed using comma as the separator e.g. sid@shephertz.com,
  *            info@shephertz.com
  * @params sendSubject
  *            - Subject of the Email which to be sent
  * @params sendMsg
  *            - Email body which has to be sent
  * @params fromEmail
  *            - The Email Id using which the mail(s) has to be sent
  * @params emailMime
  *            - MIME Type to be used for sending mail. EmailMIME available
  *            options are PLAIN_TEXT_MIME_TYPE or HTML_TEXT_MIME_TYPE
  *
  * @return Email object containing all the details used for sending mail
  */
 function sendMail($fromEmail, $sendTo, $sendSubject, $sendMsg, $emailMIME)
 {
     Util::throwExceptionIfNullOrBlank($fromEmail, "Email Id");
     Util::throwExceptionIfNullOrBlank($sendTo, "Send To");
     Util::throwExceptionIfNullOrBlank($sendSubject, "Send Subject");
     Util::throwExceptionIfNullOrBlank($sendMsg, "Send Message");
     Util::throwExceptionIfNullOrBlank($emailMIME, "EmailMIME");
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $emailMIMETypeObj = new EmailMIME();
         if ($emailMIMETypeObj->isAvailable($emailMIME) == "null") {
             throw new App42Exception("The EmailMIME with  type '{$emailMIME}' does not Exist ");
         }
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $body = null;
         $body = '{"app42":{"email":{"emailId":"' . $fromEmail . '","to":"' . $sendTo . '","subject":"' . $sendSubject . '","msg":"' . $sendMsg . '","mimeType":"' . $emailMIME . '"}}}';
         $signParams['body'] = $body;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL;
         $response = RestClient::post($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);
         $emailResponseObj = new EmailResponseBuilder();
         $emailObj = $emailResponseObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $emailObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:59,代码来源:EmailService.php

示例13: convertFormat

 /**
  * Converts the format of the image. Returns the original image url and converted image url.
  * Images are stored on the cloud and can be accessed through the urls
  * Conversion is done based on the formatToConvert provided
  *
  * @param name
  *            - Name of the image to convert
  * @param imagePath
  *            - Path of the local file to convert
  * @param formatToConvert
  *            - To which file needs to be converted
  * @return Image object containing urls for the original and converted
  *          images
  *
  * @throws App42Exception
  *
  */
 function convertFormat($name, $imagePath, $formatToConvert)
 {
     Util::throwExceptionIfNullOrBlank($name, "Name");
     Util::throwExceptionIfNullOrBlank($imagePath, "Image Path");
     Util::throwExceptionIfNotValidImageExtension($imagePath, "imagePath");
     Util::throwExceptionIfNullOrBlank($formatToConvert, "formatToConvert");
     $objUtil = new Util($this->apiKey, $this->secretKey);
     //$file = fopen($filePath, r);
     if (!file_exists($imagePath)) {
         throw new App42Exception(" File " . $imagePath . " does not exist");
     }
     //$file = new File($filePath);
     //if(!file_exists($file)){
     //throw Exception
     //}
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $postParams = array();
         $postParams['name'] = $name;
         $postParams['formatToConvert'] = $formatToConvert;
         $params = array_merge($postParams, $signParams);
         $signature = urlencode($objUtil->sign($params));
         //die();
         $params['imageFile'] = "@" . $imagePath;
         $headerParams['signature'] = $signature;
         //CONTENT_TYPE == "multipart/form-data"
         $contentType = "multipart/form-data";
         $body = null;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/convertformat";
         $response = RestClient::post($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);
         $imageResponseObj = new ImageProcessorResponseBuilder();
         $imageObj = $imageResponseObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $imageObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:63,代码来源:ImageProcessorService.php

示例14: getPaymentHistoryByUser

 /**
  * History of Carts and Payments for a User. It gives all the carts which
  * are in AUTHORIZED, DECLINED, PENDING state.
  *
  * @params userId
  *            - User Id for whom payment history has to be fetched
  *
  * @returns List containing Cart objects. Payment history can be retrieved
  *          from individual Cart object.
  */
 function getPaymentHistoryByUser($userId)
 {
     Util::throwExceptionIfNullOrBlank($userId, "User Id");
     $encodedUserId = Util::encodeParams($userId);
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $signParams['userId'] = $userId;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/payment/history/" . $encodedUserId;
         $response = RestClient::get($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $cartResponseObj = new CartResponseBuilder();
         $cartObj = $cartResponseObj->buildArrayResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $cartObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:40,代码来源:CartService.php

示例15: getAllDevicesOfUser

 function getAllDevicesOfUser($userName)
 {
     Util::throwExceptionIfNullOrBlank($userName, "User Name");
     $encodedUserName = Util::encodeParams($userName);
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $signParams['userName'] = $userName;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/getAllDevices/" . $encodedUserName;
         $response = RestClient::get($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $pushResponseObj = new PushNotificationResponseBuilder();
         $pushObj = $pushResponseObj->buildArrayResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $pushObj;
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:30,代码来源:PushNotificationService.php


注:本文中的Util::throwExceptionIfNullOrBlank方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。