1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330:
<?php
namespace LoginRadiusSDK\CustomerRegistration\Account;
use LoginRadiusSDK\Utility\Functions;
class AccountAPI {
public function __construct($apikey = '', $apisecret = '', $options = array()) {
new Functions($apikey, $apisecret, $options);
}
public function create($payload, $fields = '*') {
return $this->apiClientHandler("", array('fields' => $fields), array('method' => 'POST', 'post_data' => $payload, 'content_type' => 'json'));
}
public function getEmailVerificationToken($email, $fields = '*') {
return $this->apiClientHandler('/verify/token', array('fields' => $fields), array('method' => 'POST', 'post_data' => array('Email' => $email), 'content_type' => 'json'));
}
public function getForgotPasswordToken($email, $fields = '*') {
return $this->apiClientHandler('/forgot/token', array('fields' => $fields), array('method' => 'POST', 'post_data' => array('Email' => $email), 'content_type' => 'json'));
}
public function getIdentitiesByEmail($email, $fields = '*') {
return $this->apiClientHandler('/identities', array('email' => $email, 'fields' => $fields));
}
public function getAccessTokenByUid($uid, $fields = '*') {
return $this->apiClientHandler("/access_token", array('uid' => $uid, 'fields' => $fields));
}
public function getHashPassword($uid, $fields = '*') {
return $this->apiClientHandler("/" . $uid . "/password", array('fields' => $fields));
}
public function getProfileByEmail($email, $fields = '*') {
return $this->apiClientHandler('', array('email' => $email, 'fields' => $fields));
}
public function getProfileByUsername($username, $fields = '*') {
return $this->apiClientHandler('', array('username' => $username, 'fields' => $fields));
}
public function getProfileByPhone($phone, $fields = '*') {
return $this->apiClientHandler('', array('phone' => $phone, 'fields' => $fields));
}
public function getProfileByUid($uid, $fields = '*') {
return $this->apiClientHandler("/" . $uid, array('fields' => $fields));
}
public function setPassword($uid, $password, $fields = '*') {
return $this->apiClientHandler("/" . $uid . "/password", array('fields' => $fields), array('method' => 'PUT', 'post_data' => array('password' => $password), 'content_type' => 'json'));
}
public function update($uid, $payload, $is_null_support = 'false', $fields = '*') {
return $this->apiClientHandler('/' . $uid, array('nullsupport' => $is_null_support, 'fields' => $fields), array('method' => 'PUT', 'post_data' => $payload, 'content_type' => 'json'));
}
public function updateSecurityQuestionByUid($uid, $payload, $fields = '*') {
return $this->apiClientHandler("/" . $uid, array('fields' => $fields), array('method' => 'PUT', 'post_data' => $payload, 'content_type' => 'json'));
}
public function invalidateEmail($uid, $data, $fields = '*') {
return $this->apiClientHandler("/" . $uid . '/invalidateemail', array('fields' => $fields), array('method' => 'PUT', 'post_data' => $data, 'content_type' => 'json'));
}
public function removeEmailByUidAndEmail($uid, $email, $fields = '*') {
return $this->apiClientHandler('/' . $uid . '/email', array('fields' => $fields), array('method' => 'DELETE', 'post_data' => array('Email' => $email), 'content_type' => 'json'));
}
public function delete($uid, $fields = '*') {
return $this->apiClientHandler('/' . $uid, array('fields' => $fields), array('method' => 'DELETE', 'post_data' => true));
}
public function updateOrInsertEmailByUid($uid, $payload, $fields = '*') {
return $this->apiClientHandler('/' . $uid . '/email', array('fields' => $fields), array('method' => 'PUT', 'post_data' => $payload, 'content_type' => 'json'));
}
public function mfaGetBackupCodeByUid($uid, $fields = '*') {
return $this->apiClientHandler("/2fa/backupcode", array('uid' => $uid, 'fields' => $fields));
}
public function mfaResetBackupCodeByUid($uid, $fields = '*') {
return $this->apiClientHandler("/2fa/backupcode/reset", array('uid' => $uid, 'fields' => $fields));
}
public function mfaResetGoogleAuthenticatorByUid($uid, $googleauthenticator) {
return $this->apiClientHandler("/2fa/authenticator", array('uid' => $uid), array('method' => 'DELETE', 'post_data' => array('googleauthenticator' => $googleauthenticator), 'content_type' => 'json'));
}
public function mfaResetSMSAuthenticatorByUid($uid, $otpauthenticator) {
return $this->apiClientHandler("/2fa/authenticator", array('uid' => $uid), array('method' => 'DELETE', 'post_data' => array('otpauthenticator' => $otpauthenticator), 'content_type' => 'json'));
}
public function resetPhoneIdVerification($uid, $data, $fields = '*') {
return $this->apiClientHandler('/' . $uid . '/invalidatephone', array('fields' => $fields), array('method' => 'PUT', 'post_data' => $data, 'content_type' => 'json'));
}
public function generateSOTT($time_difference = '10', $fields = '*') {
return $this->apiClientHandler("/sott", array('timedifference' => $time_difference, 'fields' => $fields));
}
private function apiClientHandler($path, $query_array = array(), $options = array()) {
return Functions::apiClient("/identity/v2/manage/account" . $path, $query_array, array_merge(array('authentication' => 'secret'), $options));
}
}