Skip to content

Commit

Permalink
Add additional namespaces and improve types.
Browse files Browse the repository at this point in the history
  • Loading branch information
scotthovestadt committed Dec 6, 2016
1 parent 1f8527e commit 6bc2864
Show file tree
Hide file tree
Showing 12 changed files with 426 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

dist/
node_modules/
node_modules/
npm-debug.log
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"search.exclude": {
"node_modules": true,
"dist": true
},
"files.exclude": {
"node_modules": true,
"dist": true
}
}
1 change: 0 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import Gigya from './lib/gigya';
export * from './lib/gigya';
export default Gigya;
92 changes: 80 additions & 12 deletions lib/accounts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Gigya from './gigya';
import RBA from './rba';
import Webhooks from './webhooks';
import Webhooks from './accounts.webhooks';
import Account from './interfaces/account';
import SessionInfo from './interfaces/session-info';
import GigyaResponse from './interfaces/gigya-response';
Expand All @@ -15,7 +15,7 @@ export class Accounts {
this.rba = new RBA(gigya);
this.webhooks = new Webhooks(gigya);
}

/**
* This method deletes the specified user's account from Gigya's database.
*
Expand Down Expand Up @@ -78,7 +78,7 @@ export class Accounts {
public getCounters(params: any) {
return this.gigya.request<any>('accounts.getCounters', params);
}

/**
* This method retrieves account policies.
*
Expand All @@ -102,19 +102,19 @@ export class Accounts {
*
* @see http://developers.gigya.com/display/GD/accounts.getSchema+REST
*/
public getSchema(params: any) {
return this.gigya.request<any>('accounts.getSchema', params);
public getSchema(params?: AccountsGetSchemaParams) {
return this.gigya.request<AccountsGetSchemaResponse>('accounts.getSchema', params);
}

/**
* This method retrieves one or more screen-sets hosted by Gigya.
*
* @see http://developers.gigya.com/display/GD/accounts.getScreenSets+REST
*/
public getScreenSets(params: any) {
return this.gigya.request<any>('accounts.getScreenSets', params);
public getScreenSets(params?: GetScreenSetsParams) {
return this.gigya.request<GetScreenSetsResponse>('accounts.getScreenSets', params);
}

/**
* This method imports a user's profile photo to Gigya's server.
*
Expand Down Expand Up @@ -249,7 +249,7 @@ export class Accounts {
public setAccountInfo(params: any) {
return this.gigya.request<any>('accounts.setAccountInfo', params);
}

/**
* This method is used to modify site policies regarding user registration and login.
*
Expand All @@ -273,8 +273,8 @@ export class Accounts {
*
* @see http://developers.gigya.com/display/GD/accounts.setSchema+REST
*/
public setSchema(params: any) {
return this.gigya.request<any>('accounts.setSchema', params);
public setSchema(params: AccountsSetSchemaParams) {
return this.gigya.request('accounts.setSchema', params);
}

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

/**
Expand Down Expand Up @@ -344,6 +344,74 @@ export interface AccountsNotifyLoginParamsProviderSessions extends AccountsNotif
providerSessions: { [key: string]: any; };
}

export type AccountsSchemaWriteAccess = 'serverOnly' | 'clientCreate' | 'clientModify';
export type AccountsSchemaType = 'integer' | 'long' | 'float' | 'basic-string' | 'string' | 'text' | 'date' | 'boolean';
export type AccountsSchemaEncrypt = 'AES' | '';
export interface AccountsSetSchemaParams {
profileSchema?: {
fields: { [key: string]: AccountsProfileSetSchemaField | null; }
};
dataSchema?: {
fields: { [key: string]: AccountsDataSetSchemaField | null; };
dynamicSchema?: boolean;
}
scope?: 'group' | 'site';
}
export interface AccountsProfileSetSchemaField {
required?: boolean;
writeAccess?: AccountsSchemaWriteAccess;
languages?: Array<string>;
}
export interface AccountsDataSetSchemaField extends AccountsProfileSetSchemaField {
allowNull?: boolean;
encrypt?: AccountsSchemaEncrypt;
format?: string;
type?: AccountsSchemaType;
}

export interface AccountsGetSchemaParams {
filter?: 'full' | 'explicitOnly' | 'clientOnly';
scope?: 'effective' | 'group' | 'site';
}
export interface AccountsGetSchemaResponse {
profileSchema: {
fields: { [key: string]: AccountsProfileGetSchemaField; }
};
dataSchema: {
fields: { [key: string]: AccountsDataGetSchemaField; };
}
}
export interface AccountsProfileGetSchemaField {
required: boolean;
writeAccess: AccountsSchemaWriteAccess;
languages?: Array<string>;
}
export interface AccountsDataGetSchemaField extends AccountsProfileSetSchemaField {
allowNull?: boolean;
encrypt?: AccountsSchemaEncrypt;
format?: string;
type: AccountsSchemaType;
}

export interface GetScreenSetsParams {
screenSetIDs?: string | Array<string>;
include?: string;
}
export interface GetScreenSetsResponse {
screenSets: Array<{
screenSetID: string;
html: string;
css: string;
metadata: {
desc?: string;
designerHtml: string;
targetEnv: string;
lastModified?: string;
version?: number;
};
}>;
}

export default Accounts;


File renamed without changes.
81 changes: 81 additions & 0 deletions lib/fidm.oidc.op.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import Gigya from './gigya';
import GigyaResponse from './interfaces/gigya-response';

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

/**
* This API deletes an existing OP configuration.
*
* @see http://developers.gigya.com/display/GD/fidm.oidc.op.clearConfig+REST
*/
public clearConfig(params: any) {
return this.gigya.request('fidm.oidc.op.clearConfig', params);
}

/**
* This API registers and configures a new RP  for the OP .
*
* @see http://developers.gigya.com/display/GD/fidm.oidc.op.createRP+REST
*/
public createRP(params: any) {
return this.gigya.request('fidm.oidc.op.createRP', params);
}

/**
* This API deletes an existing OP configuration.
*
* @see http://developers.gigya.com/display/GD/fidm.oidc.op.delRP+REST
*/
public delRP(params: any) {
return this.gigya.request('fidm.oidc.op.delRP', params);
}

/**
* This API retrieves the site OP  configuration relevant for all clients/relying-parties of the site.
*
* @see http://developers.gigya.com/display/GD/fidm.oidc.op.getConfig+REST
*/
public getConfig(params: any) {
return this.gigya.request('fidm.oidc.op.getConfig', params);
}

/**
* This API returns the configuration data for a specified RP .
*
* @see http://developers.gigya.com/display/GD/fidm.oidc.op.getRP+REST
*/
public getRP(params: any) {
return this.gigya.request('fidm.oidc.op.getRP', params);
}

/**
* This API Returns all the currently registered RPs  for the OP .
*
* @see http://developers.gigya.com/display/GD/fidm.oidc.op.getRPs+REST
*/
public getRPs(params: any) {
return this.gigya.request('fidm.oidc.op.getRPs', params);
}

/**
* This API initiates the OP  functionality for your site. The configuration of the OP is relevant to all of the site's RPs .
*
* @see http://developers.gigya.com/display/GD/fidm.oidc.op.setConfig+REST
*/
public setConfig(params: any) {
return this.gigya.request('fidm.oidc.op.setConfig', params);
}

/**
* This API updates the configuration of an existing RP  configured on the OP.
*
* @see http://developers.gigya.com/display/GD/fidm.oidc.op.updateRP+REST
*/
public updateRP(params: any) {
return this.gigya.request('fidm.oidc.op.updateRP', params);
}
}

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

export class OIDC {
public readonly op: OP;

constructor(protected gigya: Gigya) {
this.op = new OP(gigya);
}
}

export default OIDC;
63 changes: 63 additions & 0 deletions lib/fidm.saml.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 SAML {
constructor(protected gigya: Gigya) {
}

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

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

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

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

export class FIDM {
public readonly oidc: OIDC;
public readonly saml: SAML;

constructor(protected gigya: Gigya) {
this.oidc = new OIDC(gigya);
this.saml = new SAML(gigya);
}
}

export default FIDM;
8 changes: 6 additions & 2 deletions lib/gigya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import SigUtils from './sig-utils';
import Socialize from './socialize';
import Accounts from './accounts';
import DS from './ds';
import GM from './gm';
import FIDM from './fidm';
import GigyaError from './gigya-error';
import GigyaResponse from './interfaces/gigya-response';
import ErrorCode from './interfaces/error-code';
Expand All @@ -19,6 +21,8 @@ export class Gigya {
public readonly socialize: Socialize;
public readonly accounts: Accounts;
public readonly ds: DS;
public readonly gm: GM;
public readonly fidm: FIDM;

constructor(APIKey: string, dataCenter: string, secret: string);
constructor(APIKey: string, dataCenter: string, userKey: string, secret?: string);
Expand All @@ -37,6 +41,8 @@ export class Gigya {
this.socialize = new Socialize(this);
this.accounts = new Accounts(this);
this.ds = new DS(this);
this.gm = new GM(this);
this.fidm = new FIDM(this);
}

protected http<R>(uri: string, params: any): Promise<GigyaResponse & R> {
Expand Down Expand Up @@ -155,6 +161,4 @@ export class Gigya {
}
}

export * from './gigya-error';

export default Gigya;
Loading

0 comments on commit 6bc2864

Please sign in to comment.