Skip to content

Commit

Permalink
Add additional namespaces. Improve types.
Browse files Browse the repository at this point in the history
  • Loading branch information
scotthovestadt committed Dec 8, 2016
1 parent 235fd1c commit 7167986
Show file tree
Hide file tree
Showing 12 changed files with 324 additions and 29 deletions.
8 changes: 7 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
import Gigya from './lib/gigya';
import { Gigya } from './lib/gigya';

export { Gigya } from './lib/gigya';
export { GigyaResponse } from './lib/interfaces/gigya-response';
export { ErrorCode } from './lib/interfaces/error-code';
export { SessionExpirationEnum as SessionExpiration } from './lib/interfaces/session-expiration';

export default Gigya;
27 changes: 17 additions & 10 deletions lib/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class Accounts {
* @see http://developers.gigya.com/display/GD/accounts.importProfilePhoto+REST
*/
public importProfilePhoto(params: any) {
return this.gigya.request<any>('accounts.importProfilePhoto', params);
return this.gigya.request('accounts.importProfilePhoto', params);
}

/**
Expand All @@ -130,7 +130,7 @@ export class Accounts {
* @see http://developers.gigya.com/display/GD/accounts.incrementCounters+REST
*/
public incrementCounters(params: any) {
return this.gigya.request<any>('accounts.incrementCounters', params);
return this.gigya.request('accounts.incrementCounters', params);
}

/**
Expand All @@ -147,8 +147,8 @@ export class Accounts {
*
* @see http://developers.gigya.com/display/GD/accounts.isAvailableLoginID+REST
*/
public isAvailableLoginID(params: any) {
return this.gigya.request<any>('accounts.isAvailableLoginID', params);
public isAvailableLoginID(params: AccountsIsAvailableLoginIDParams) {
return this.gigya.request<AccountsIsAvailableLoginIDResponse>('accounts.isAvailableLoginID', params);
}

/**
Expand Down Expand Up @@ -220,7 +220,7 @@ export class Accounts {
* @see http://developers.gigya.com/display/GD/accounts.resendVerificationCode+REST
*/
public resendVerificationCode(params: any) {
return this.gigya.request<any>('accounts.resendVerificationCode', params);
return this.gigya.request('accounts.resendVerificationCode', params);
}

/**
Expand All @@ -229,7 +229,7 @@ export class Accounts {
* @see http://developers.gigya.com/display/GD/accounts.resetPassword+REST
*/
public resetPassword(params: any) {
return this.gigya.request<any>('accounts.resetPassword', params);
return this.gigya.request('accounts.resetPassword', params);
}

/**
Expand All @@ -247,7 +247,7 @@ export class Accounts {
* @see http://developers.gigya.com/display/GD/accounts.setAccountInfo+REST
*/
public setAccountInfo(params: any) {
return this.gigya.request<any>('accounts.setAccountInfo', params);
return this.gigya.request('accounts.setAccountInfo', params);
}

/**
Expand All @@ -256,7 +256,7 @@ export class Accounts {
* @see http://developers.gigya.com/display/GD/accounts.setPolicies+REST
*/
public setPolicies(params: any) {
return this.gigya.request<any>('accounts.setPolicies', params);
return this.gigya.request('accounts.setPolicies', params);
}

/**
Expand All @@ -265,7 +265,7 @@ export class Accounts {
* @see http://developers.gigya.com/display/GD/accounts.setProfilePhoto+REST
*/
public setProfilePhoto(params: any) {
return this.gigya.request<any>('accounts.setProfilePhoto', params);
return this.gigya.request('accounts.setProfilePhoto', params);
}

/**
Expand All @@ -292,7 +292,7 @@ export class Accounts {
* @see http://developers.gigya.com/display/GD/accounts.unregisterCounters+REST
*/
public unregisterCounters(params: any) {
return this.gigya.request<any>('accounts.unregisterCounters', params);
return this.gigya.request('accounts.unregisterCounters', params);
}
}

Expand Down Expand Up @@ -412,6 +412,13 @@ export interface GetScreenSetsResponse {
}>;
}

export interface AccountsIsAvailableLoginIDParams {
loginID: string;
}
export interface AccountsIsAvailableLoginIDResponse {
isAvailable: boolean;
}

export default Accounts;


18 changes: 15 additions & 3 deletions lib/ds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class DS {
* @see http://developers.gigya.com/display/GD/ds.getSchema+REST
*/
public getSchema(params: any) {
return this.gigya.request('ds.getSchema', params);
return this.gigya.request<any>('ds.getSchema', params);
}

/**
Expand All @@ -55,8 +55,8 @@ export class DS {
*
* @see http://developers.gigya.com/display/GD/ds.store+REST
*/
public store(params: any) {
return this.gigya.request('ds.setSchema', params);
public store(params: DSStoreParams) {
return this.gigya.request<DSStoreResponse>('ds.setSchema', params);
}
}

Expand Down Expand Up @@ -93,4 +93,16 @@ export interface DSSearchResponse {
nextCursorId?: string;
}

export type DSStoreUpdateBehavior = 'arrayPush' | 'arraySet' | 'replace';
export interface DSStoreParams {
data: any;
type: string;
oid: string | 'auto';
UID?: string;
updateBehavior: 'arrayPush' | 'arraySet' | 'replace';
}
export interface DSStoreResponse {
oid: string;
}

export default DS;
63 changes: 63 additions & 0 deletions lib/fidm.saml.idp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import Gigya from './gigya';
import GigyaResponse from './interfaces/gigya-response';

export class IdP {
constructor(protected gigya: Gigya) {
}

/**
* This API deletes a SAML Identity Provider (IdP).
*
* @see http://developers.gigya.com/display/GD/fidm.saml.idp.delIdP+REST
*/
public delIdP(params: any) {
return this.gigya.request('fidm.saml.idp.delIdP', params);
}

/**
* This API retrieves the Gigya site configuration for SAML.
*
* @see http://developers.gigya.com/display/GD/fidm.saml.idp.getConfig+REST
*/
public getConfig(params: any) {
return this.gigya.request<any>('fidm.saml.idp.getConfig', params);
}

/**
* This API retrieves all the SAML IdP configuration objects that are defined for the site.
*
* @see http://developers.gigya.com/display/GD/fidm.saml.idp.getRegisteredIdPs+REST
*/
public getRegisteredIdPs(params: any) {
return this.gigya.request<any>('fidm.saml.idp.getRegisteredIdPs', params);
}

/**
* This API imports a SAML Identity Provider (IdP) configuration from a SAML metadata XML.
*
* @see http://developers.gigya.com/display/GD/fidm.saml.idp.importIdPMetadata+REST
*/
public importIdPMetadata(params: any) {
return this.gigya.request<any>('fidm.saml.idp.importIdPMetadata', params);
}

/**
* This API updates or registers a SAML configuration for a specific Identity Provider (IdP).
*
* @see http://developers.gigya.com/display/GD/fidm.saml.idp.registerIdP+REST
*/
public registerIdP(params: any) {
return this.gigya.request('fidm.saml.idp.registerIdP', params);
}

/**
* This API updates the Gigya SAML site configuration.
*
* @see http://developers.gigya.com/display/GD/fidm.saml.idp.setConfig+REST
*/
public setConfig(params: any) {
return this.gigya.request('fidm.saml.idp.setConfig', params);
}
}

export default IdP;
10 changes: 7 additions & 3 deletions lib/fidm.saml.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import Gigya from './gigya';
import GigyaResponse from './interfaces/gigya-response';
import IdP from './fidm.saml.idp';

export class SAML {
public readonly idp: IdP;

constructor(protected gigya: Gigya) {
this.idp = new IdP(gigya);
}

/**
Expand All @@ -20,7 +24,7 @@ export class SAML {
* @see http://developers.gigya.com/display/GD/fidm.saml.getConfig+REST
*/
public getConfig(params: any) {
return this.gigya.request('fidm.saml.getConfig', params);
return this.gigya.request<any>('fidm.saml.getConfig', params);
}

/**
Expand All @@ -29,7 +33,7 @@ export class SAML {
* @see http://developers.gigya.com/display/GD/fidm.saml.getRegisteredIdPs+REST
*/
public getRegisteredIdPs(params: any) {
return this.gigya.request('fidm.saml.getRegisteredIdPs', params);
return this.gigya.request<any>('fidm.saml.getRegisteredIdPs', params);
}

/**
Expand All @@ -38,7 +42,7 @@ export class SAML {
* @see http://developers.gigya.com/display/GD/fidm.saml.importIdPMetadata+REST
*/
public importIdPMetadata(params: any) {
return this.gigya.request('fidm.saml.importIdPMetadata', params);
return this.gigya.request<any>('fidm.saml.importIdPMetadata', params);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions lib/gigya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Accounts from './accounts';
import DS from './ds';
import GM from './gm';
import FIDM from './fidm';
import Reports from './reports';
import GigyaError from './gigya-error';
import GigyaResponse from './interfaces/gigya-response';
import ErrorCode from './interfaces/error-code';
Expand All @@ -23,6 +24,7 @@ export class Gigya {
public readonly ds: DS;
public readonly gm: GM;
public readonly fidm: FIDM;
public readonly reports: Reports;

constructor(APIKey: string, dataCenter: string, secret: string);
constructor(APIKey: string, dataCenter: string, userKey: string, secret?: string);
Expand All @@ -43,6 +45,7 @@ export class Gigya {
this.ds = new DS(this);
this.gm = new GM(this);
this.fidm = new FIDM(this);
this.reports = new Reports(this);
}

protected http<R>(uri: string, params: any): Promise<GigyaResponse & R> {
Expand Down
16 changes: 8 additions & 8 deletions lib/gm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class GM {
* @see http://developers.gigya.com/display/GD/gm.deleteChallenge+REST
*/
public deleteChallenge(params: any) {
return this.gigya.request('gm.deleteChallenge', params);
return this.gigya.request<any>('gm.deleteChallenge', params);
}

/**
Expand All @@ -38,7 +38,7 @@ export class GM {
* @see http://developers.gigya.com/display/GD/gm.getActionConfig+REST
*/
public getActionConfig(params: any) {
return this.gigya.request('gm.getActionConfig', params);
return this.gigya.request<any>('gm.getActionConfig', params);
}

/**
Expand All @@ -47,7 +47,7 @@ export class GM {
* @see http://developers.gigya.com/display/GD/gm.getActionsLog+REST
*/
public getActionsLog(params: any) {
return this.gigya.request('gm.getActionsLog', params);
return this.gigya.request<any>('gm.getActionsLog', params);
}

/**
Expand All @@ -56,7 +56,7 @@ export class GM {
* @see http://developers.gigya.com/display/GD/gm.getChallengeConfig+REST
*/
public getChallengeConfig(params: any) {
return this.gigya.request('gm.getChallengeConfig', params);
return this.gigya.request<any>('gm.getChallengeConfig', params);
}

/**
Expand All @@ -65,7 +65,7 @@ export class GM {
* @see http://developers.gigya.com/display/GD/gm.getChallengeStatus+REST
*/
public getChallengeStatus(params: any) {
return this.gigya.request('gm.getChallengeStatus', params);
return this.gigya.request<any>('gm.getChallengeStatus', params);
}

/**
Expand All @@ -74,7 +74,7 @@ export class GM {
* @see http://developers.gigya.com/display/GD/gm.getChallengeVariants+REST
*/
public getChallengeVariants(params: any) {
return this.gigya.request('gm.getChallengeVariants', params);
return this.gigya.request<any>('gm.getChallengeVariants', params);
}

/**
Expand All @@ -83,7 +83,7 @@ export class GM {
* @see http://developers.gigya.com/display/GD/gm.getGlobalConfig+REST
*/
public getGlobalConfig(params: any) {
return this.gigya.request('gm.getGlobalConfig', params);
return this.gigya.request<any>('gm.getGlobalConfig', params);
}

/**
Expand All @@ -92,7 +92,7 @@ export class GM {
* @see http://developers.gigya.com/display/GD/gm.getTopUsers+REST
*/
public getTopUsers(params: any) {
return this.gigya.request('gm.getTopUsers', params);
return this.gigya.request<any>('gm.getTopUsers', params);
}

/**
Expand Down
Loading

0 comments on commit 7167986

Please sign in to comment.