baasic-sdk-javascript
Version:
JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
63 lines (62 loc) • 3.39 kB
TypeScript
/**
* @module loginSocialClient
* @description Login Social Client provides an easy way to consume Application Registration REST API end-points. In order to obtain needed routes `loginSocialClient` uses `loginSocialRoute`.
*/
import { ApiClient, IHttpResponse } from '../../httpApi';
import { ITokenHandler } from '../../core/contracts';
import { LoginSocialRoute } from './';
import { ISocialLogin } from './contracts';
export declare class LoginSocialClient {
protected loginSocialRoute: LoginSocialRoute;
protected tokenHandler: ITokenHandler;
protected apiClient: ApiClient;
readonly routeDefinition: LoginSocialRoute;
constructor(loginSocialRoute: LoginSocialRoute, tokenHandler: ITokenHandler, apiClient: ApiClient);
/**
* Returns a promise that is resolved once the get action has been performed. Success response returns a resolved social login provider Url.
* @method
* @param provider Provider name or id for which the login URL should be generated.
* @param returnUrl Redirect Uri for the provider which will be used when the user is redirected back to the application.
* @returns A promise that is resolved once the get action has been performed.
* @example loginSocialClient.get('<provider>', '<returnUrl>')
.then(function (collection) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
get(provider: string, returnUrl: string): PromiseLike<IHttpResponse<any>>;
/**
* Returns a promise that is resolved once the post action has been performed. This action logs user into the application and success response returns the token resource.
* @method
* @param provider Provider name or Id which uniquely identifies social login for which access token should be issued.
* @param data Object used to identify social login information.
* @param options Comma separated list of additional options defining token behavior. Supported values are: "session" and "sliding".
* @example let postData = {
email : '<email>',
code:'<code>',
activationUrl : '<activationUrl>',
oAuthToken : '<oAuthToken>',
oAuthVerifier : '<oAuthVerifier>',
password : '<password>',
returnUrl : '<returnUrl>'
};
loginSocialClient.post('<provider>', postData)
.then(function (collection) {
// perform success action here
},
function (response, status, headers, config) {
// perform error handling here
});
**/
post(provider: string, data: ISocialLogin, options?: any): PromiseLike<void>;
parseResponse(provider: string, returnUrl: string): any;
private parseUrlParams;
}
/**
* @overview
***Notes:**
- Refer to the [Baasic REST API](http://dev.baasic.com/api/reference/home) for detailed information about available Baasic REST API end-points.
- All end-point objects are transformed by the associated route definition.
*/