Skip to content

Commit 935ac01

Browse files
author
RutujaAwate122
authored
Merge pull request #31 from onelogin/DEVEX-onelogin-node-sdk
DEVEX-1891
2 parents a087d87 + 120c17c commit 935ac01

File tree

2 files changed

+154
-56
lines changed

2 files changed

+154
-56
lines changed

api/defaultApi.ts

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3614,13 +3614,19 @@ export class DefaultApi {
36143614
*/
36153615
public async generateMfaToken(
36163616
authorization: string,
3617+
userId: number,
36173618
generateMfaTokenRequest: GenerateMfaTokenRequest,
36183619
options: { headers: { [name: string]: string } } = { headers: {} }
36193620
): Promise<{
36203621
response: http.IncomingMessage;
36213622
body: GenerateMfaToken200Response;
36223623
}> {
3623-
const localVarPath = this.basePath + "/api/2/mfa/users/{user_id}/mfa_token";
3624+
const localVarPath =
3625+
this.basePath +
3626+
"/api/1/users/{user_id}/mfa_token".replace(
3627+
"{" + "user_id" + "}",
3628+
encodeURIComponent(String(userId))
3629+
);
36243630
let localVarQueryParameters: any = {};
36253631
let localVarHeaderParams: any = (<any>Object).assign(
36263632
{},
@@ -16188,4 +16194,122 @@ export class DefaultApi {
1618816194
});
1618916195
});
1619016196
}
16197+
16198+
public async verifyingFactor(
16199+
authorization: string,
16200+
userId: number,
16201+
verifyFactorRequest: VerifyFactorRequest,
16202+
options: { headers: { [name: string]: string } } = { headers: {} }
16203+
): Promise<{
16204+
response: http.IncomingMessage;
16205+
body: VerifyFactorVoice200ResponseInner;
16206+
}> {
16207+
const localVarPath =
16208+
this.basePath +
16209+
"/api/2/mfa/users/{user_id}/verifications/".replace(
16210+
"{" + "user_id" + "}",
16211+
encodeURIComponent(String(userId))
16212+
);
16213+
let localVarQueryParameters: any = {};
16214+
let localVarHeaderParams: any = (<any>Object).assign(
16215+
{},
16216+
this._defaultHeaders
16217+
);
16218+
const produces = ["application/json"];
16219+
// give precedence to 'application/json'
16220+
if (produces.indexOf("application/json") >= 0) {
16221+
localVarHeaderParams.Accept = "application/json";
16222+
} else {
16223+
localVarHeaderParams.Accept = produces.join(",");
16224+
}
16225+
let localVarFormParams: any = {};
16226+
16227+
// verify required parameter 'authorization' is not null or undefined
16228+
if (authorization === null || authorization === undefined) {
16229+
throw new Error(
16230+
"Required parameter authorization was null or undefined when calling verifyingFactor."
16231+
);
16232+
}
16233+
16234+
// verify required parameter 'userId' is not null or undefined
16235+
if (userId === null || userId === undefined) {
16236+
throw new Error(
16237+
"Required parameter userId was null or undefined when calling verifyingFactor."
16238+
);
16239+
}
16240+
16241+
// verify required parameter 'verifyFactorRequest' is not null or undefined
16242+
if (verifyFactorRequest === null || verifyFactorRequest === undefined) {
16243+
throw new Error(
16244+
"Required parameter verifyFactorRequest was null or undefined when calling verifyingFactor."
16245+
);
16246+
}
16247+
16248+
localVarHeaderParams["Authorization"] = ObjectSerializer.serialize(
16249+
authorization,
16250+
"string"
16251+
);
16252+
(<any>Object).assign(localVarHeaderParams, options.headers);
16253+
16254+
let localVarUseFormData = false;
16255+
16256+
let localVarRequestOptions: localVarRequest.Options = {
16257+
method: "POST",
16258+
qs: localVarQueryParameters,
16259+
headers: localVarHeaderParams,
16260+
uri: localVarPath,
16261+
useQuerystring: this._useQuerystring,
16262+
json: true,
16263+
body: ObjectSerializer.serialize(
16264+
verifyFactorRequest,
16265+
"VerifyFactorRequest"
16266+
),
16267+
};
16268+
16269+
let authenticationPromise = Promise.resolve();
16270+
authenticationPromise = authenticationPromise.then(() =>
16271+
this.authentications.default.applyToRequest(localVarRequestOptions)
16272+
);
16273+
16274+
let interceptorPromise = authenticationPromise;
16275+
for (const interceptor of this.interceptors) {
16276+
interceptorPromise = interceptorPromise.then(() =>
16277+
interceptor(localVarRequestOptions)
16278+
);
16279+
}
16280+
16281+
return interceptorPromise.then(() => {
16282+
if (Object.keys(localVarFormParams).length) {
16283+
if (localVarUseFormData) {
16284+
(<any>localVarRequestOptions).formData = localVarFormParams;
16285+
} else {
16286+
localVarRequestOptions.form = localVarFormParams;
16287+
}
16288+
}
16289+
return new Promise<{
16290+
response: http.IncomingMessage;
16291+
body: VerifyFactorVoice200ResponseInner;
16292+
}>((resolve, reject) => {
16293+
localVarRequest(localVarRequestOptions, (error, response, body) => {
16294+
if (error) {
16295+
reject(error);
16296+
} else {
16297+
if (
16298+
response.statusCode &&
16299+
response.statusCode >= 200 &&
16300+
response.statusCode <= 299
16301+
) {
16302+
body = ObjectSerializer.deserialize(
16303+
body,
16304+
"VerifyFactorVoice200ResponseInner"
16305+
);
16306+
resolve({ response: response, body: body });
16307+
} else {
16308+
reject(new HttpError(response, body, response.statusCode));
16309+
}
16310+
}
16311+
});
16312+
});
16313+
});
16314+
}
1619116315
}
Lines changed: 29 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,35 @@
1-
/**
2-
* OneLogin API
3-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4-
*
5-
* The version of the OpenAPI document: 3.0.0-alpha.1
6-
*
7-
*
8-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9-
* https://openapi-generator.tech
10-
* Do not edit the class manually.
11-
*/
1+
export class GenerateMfaToken200Response {
2+
"mfaToken"?: string;
123

13-
import { RequestFile } from './models';
4+
"reusable"?: boolean;
145

15-
export class GenerateMfaToken200Response {
16-
/**
17-
* Token can function as a temporary MFA token. It can be used to authenticate for any app when valid.
18-
*/
19-
'mfaToken'?: string;
20-
/**
21-
* true indcates the token can be used multiple times. false indicates the token is invalid after a single use
22-
*/
23-
'reusable'?: boolean;
24-
/**
25-
* Defines the expiration time and date for the token. Format is UTC time.
26-
*/
27-
'expiresAt'?: string;
28-
/**
29-
* Defines the expiration time and date for the token. Format is UTC time.
30-
*/
31-
'deviceId'?: string;
6+
"expiresAt"?: string;
327

33-
static discriminator: string | undefined = undefined;
8+
static discriminator: string | undefined = undefined;
349

35-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
36-
{
37-
"name": "mfaToken",
38-
"baseName": "mfa_token",
39-
"type": "string"
40-
},
41-
{
42-
"name": "reusable",
43-
"baseName": "reusable",
44-
"type": "boolean"
45-
},
46-
{
47-
"name": "expiresAt",
48-
"baseName": "expires_at",
49-
"type": "string"
50-
},
51-
{
52-
"name": "deviceId",
53-
"baseName": "device_id",
54-
"type": "string"
55-
} ];
10+
static attributeTypeMap: Array<{
11+
name: string;
12+
baseName: string;
13+
type: string;
14+
}> = [
15+
{
16+
name: "mfaToken",
17+
baseName: "mfa_token",
18+
type: "string",
19+
},
20+
{
21+
name: "reusable",
22+
baseName: "reusable",
23+
type: "boolean",
24+
},
25+
{
26+
name: "expiresAt",
27+
baseName: "expires_at",
28+
type: "string",
29+
},
30+
];
5631

57-
static getAttributeTypeMap() {
58-
return GenerateMfaToken200Response.attributeTypeMap;
59-
}
32+
static getAttributeTypeMap() {
33+
return GenerateMfaToken200Response.attributeTypeMap;
34+
}
6035
}
61-

0 commit comments

Comments
 (0)