Overview

Namespaces

  • LoginRadiusSDK
    • Advance
    • Clients
    • CustomerRegistration
      • Account
      • Authentication
      • Social
    • Utility

Classes

  • LoginRadiusSDK\Advance\ConfigAPI
  • LoginRadiusSDK\Advance\WebHooksAPI
  • LoginRadiusSDK\Clients\DefaultHttpClient
  • LoginRadiusSDK\CustomerRegistration\Account\AccountAPI
  • LoginRadiusSDK\CustomerRegistration\Account\CustomObjectAPI
  • LoginRadiusSDK\CustomerRegistration\Account\CustomRegistrationDataAPI
  • LoginRadiusSDK\CustomerRegistration\Account\RoleAPI
  • LoginRadiusSDK\CustomerRegistration\Authentication\AuthCustomObjectAPI
  • LoginRadiusSDK\CustomerRegistration\Authentication\UserAPI
  • LoginRadiusSDK\CustomerRegistration\Social\AdvanceSocialLoginAPI
  • LoginRadiusSDK\CustomerRegistration\Social\SocialLoginAPI
  • LoginRadiusSDK\Utility\Functions

Interfaces

  • LoginRadiusSDK\Clients\IHttpClient

Exceptions

  • LoginRadiusSDK\LoginRadiusException
  • Overview
  • Namespace
  • Class
  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: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 
<?php

/**
 * @link                : http://www.loginradius.com
 * @category            : CustomerRegistration
 * @package             : SocialLoginAPI
 * @author              : LoginRadius Team
 * @license             : https://opensource.org/licenses/MIT
 */

namespace LoginRadiusSDK\CustomerRegistration\Social;

use LoginRadiusSDK\Utility\Functions;
use LoginRadiusSDK\LoginRadiusException;

/**
 * Class for SocialLoginAPI.
 *
 * This is the main class to communicate with LoginRadius Unified Social API.
 */
class SocialLoginAPI
{

    /**
     *
     * @param type $apikey
     * @param type $apisecret
     * @param type $options
     */
    function __construct($apikey = '', $apisecret = '', $options = array())
    {
        new Functions($apikey, $apisecret, $options);
    }

    /**
     *
     * LoginRadius function - Fetch LoginRadius access token after authentication. It will be valid for the specific duration of time specified in the response.
     * @param string $request_token LoginRadius API token
     *
     * @return mixed string|object LoginRadius access token.
     */
    public function exchangeAccessToken($request_token, $fields = '*')
    {
        return $this->apiClientHandler('access_token', false, array("token" => $request_token, "secret" => Functions::getApiSecret(), 'fields' => $fields));
    }

    /**
     * LoginRadius function - To fetch social profile data from the user's social account after authentication. The social profile will be retrieved via oAuth and OpenID protocols. The data is normalized into LoginRadius' standard data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User profile data.
     */
    public function getUserProfiledata($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler('userprofile', $raw, array("access_token" => $access_token, 'fields' => $fields));
    }
    
    /**
     * LoginRadius function - To fetch custom fileds of raas. The social profile will be retrieved via oAuth and OpenID protocols. The data is normalized into LoginRadius' standard data format.
     *
     * @param string $apiKey LoginRadius api key
     * @param string $secret LoginRadius secret key
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object custom fields of raas.
     */
    public function getUserCustomFields($apikey, $secret, $raw = false, $fields = '*') {
        return $this->apiClientHandler('userprofile/fields', $raw, array('apikey' => $apikey, 'apisecret' => $secret, 'fields' => $fields));
    }
    
    /**
     * LoginRadius function - To get the Albums data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User's albums data.
     */
    public function getPhotoAlbums($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler('album', $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To fetch photo data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param string $album_id ID of the album to fetch photos from
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User's photo data.
     */
    public function getPhotos($access_token, $album_id, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("photo", $raw, array("access_token" => $access_token, "albumid" => $album_id, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To fetch check-ins data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User's check-ins.
     */
    public function getCheckins($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler('checkin', $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To fetch user's audio files data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User's audio files data.
     */
    public function getAudio($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("audio", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To fetch user's contacts/friends/connections data from the user's social account. The data will normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param integer $next_cursor Offset to start fetching contacts from
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User's contacts/friends/followers.
     */
    public function getContacts($access_token, $next_cursor = '', $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("contact", $raw, array("access_token" => $access_token, "nextcursor" => $next_cursor, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get mention data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User's twitter mentions.
     */
    public function getMentions($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("mention", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To fetch information of the people, user is following on Twitter.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object Information of the people, user is following.
     */
    public function getFollowing($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("following", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get the event data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User's event data.
     */
    public function getEvents($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("event", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get posted messages from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object User's posted messages.
     *
     */
    public function getPosts($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("post", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get the followed company's data in the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object Companies followed by user.
     */
    public function getFollowedCompanies($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("company", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get group data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object Group data.
     */
    public function getGroups($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("group", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get the status messages from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object Status messages.
     */
    public function getStatus($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("status", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get videos data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object Videos data.
     */
    public function getVideos($access_token, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("video", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get likes data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object likes data.
     */
    public function getLikes($access_token, $raw = false, $fields = '*')
    { 
        return $this->apiClientHandler("like", $raw, array("access_token" => $access_token, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To get the page data from the user's social account. The data will be normalized into LoginRadius' data format.
     *
     * @param string $access_token LoginRadius access token
     * @param string $page_name Page name
     * @param boolean $raw If true, raw data is fetched
     *
     * @return object Page data.
     */
    public function getPages($access_token, $page_name, $raw = false, $fields = '*')
    {
        return $this->apiClientHandler("page", $raw, array("access_token" => $access_token, "pagename" => $page_name, 'fields' => $fields));
    }

    /**
     * LoginRadius function - To update the status on the user's wall.
     *
     * @param string $access_token LoginRadius access token
     * @param string $status The status message text (Required).
     * @param string $title Title for status message (Optional).
     * @param string $url A web link of the status message (Optional).
     * @param string $imageurl An image URL of the status message (Optional).     
     * @param string $caption Caption of the status message (Optional).
     * @param string $description Description of the status message (Optional).
     *
     * @return boolean Returns true if successful, false otherwise.
     *
     */
    public function postStatus($access_token, $status, $title = '', $url = '', $imageurl = '', $caption = '', $description = '', $fields = '*')
    {
        $data = array(
            'access_token' => $access_token,
            'title' => $title,
            'url' => $url,
            'imageurl' => $imageurl,
            'status' => $status,
            'caption' => $caption,
            'description' => $description,
            'fields' => $fields
        );
        return $this->apiClientHandler("status", false, $data, array('method' => 'POST', 'post_data' => true));
    }

    /**
     * LoginRadius function - Post messages to the user's contacts. After using the Contact API, you can send messages to the retrieved contacts.
     *
     * @param string $access_token LoginRadius access token
     * @param string $to Social ID of the receiver
     * @param string $subject Subject of the message
     * @param string $message Message
     *
     * @return bool True on success, false otherwise
     */
    public function sendMessage($access_token, $to, $subject, $message, $fields = '*')
    {
        $data = array(
            'access_token' => $access_token,
            'to' => $to,
            'subject' => $subject,
            'message' => $message,
            'fields' => $fields
        );
        return $this->apiClientHandler("message", false, $data, array('method' => 'POST', 'post_data' => true));
    }
    
    /**
     * LoginRadius function - This API is used to validate access_token, check it is valid, expired or active.
     *
     * @param string $access_token LoginRadius access token
     *
     * @return object User profile data.
     */
    public function tokenValidate($access_token, $fields = '*')
    {
        return $this->apiClientHandler('access_token/Validate', false, array("key" => Functions::getApiKey(),"secret" => Functions::getApiSecret(),"access_token" => $access_token, 'fields' => $fields));
    }
    
    /**
     * LoginRadius function - This API is used to invalidate access token, means expiring token. After this API call passed access_token no longer be active and will not accepted by LoginRadius APIs.
     *
     * @param string $access_token LoginRadius access token
     *
     * @return object User profile data.
     */
    public function tokenInvalidate($access_token, $fields = '*')
    {
        return $this->apiClientHandler('access_token/invalidate', false, array("key" => Functions::getApiKey(),"secret" => Functions::getApiSecret(),"access_token" => $access_token, 'fields' => $fields));
    }


    /**
     * LoginRadius function - This API is used to validate API key and Secret.
     *
     * @return object.
     */
    public function validateKeyandSecret($fields = '*')
    {
         return $this->apiClientHandler('app/validate', false, array("apikey" => rawurlencode(Functions::getApiKey()),"apisecret" => rawurlencode(Functions::getApiSecret()), 'fields' => $fields));
    }

    /**
     * Social API heandler
     *
     * @param type $path
     * @param type $raw_data
     * @param type $query_array
     * @param type $options
     * @return type
     */
    private function apiClientHandler($path, $raw_data, $query_array = array(), $options = array())
    {
        $raw = $raw_data ? '/raw' : '';
        return Functions::apiClient("/api/v2/" . $path . $raw, $query_array, $options);
    }

}
API documentation generated by ApiGen