@opportify/sdk-nodejs
Advanced tools
Comparing version 0.1.0 to 0.1.1
import { AnalyzeEmailRequest } from '../lib/v1/models/AnalyzeEmailRequest'; | ||
export type EmailInsightsConfiguration = { | ||
apiKey: string; | ||
version: string; | ||
basePath?: string; | ||
}; | ||
export declare class EmailInsights { | ||
@@ -8,0 +3,0 @@ private emailInsightsApi; |
@@ -15,9 +15,15 @@ "use strict"; | ||
async analyze(request) { | ||
return this.emailInsightsApi.analyzeEmail({ | ||
analyzeEmailRequest: { | ||
email: request.email, | ||
enableAutoCorrection: request.enableAutoCorrection, | ||
enableAI: request.enableAI, | ||
} | ||
}); | ||
try { | ||
return await this.emailInsightsApi.analyzeEmail({ | ||
analyzeEmailRequest: { | ||
email: request.email, | ||
enableAutoCorrection: request.enableAutoCorrection, | ||
enableAI: request.enableAI, | ||
} | ||
}); | ||
} | ||
catch (error) { | ||
const errorResponse = await error.response.json(); | ||
throw errorResponse; | ||
} | ||
} | ||
@@ -24,0 +30,0 @@ ; |
@@ -1,5 +0,7 @@ | ||
export { type EmailInsightsConfiguration, EmailInsights } from './emailInsights'; | ||
export { EmailInsights } from './emailInsights'; | ||
export { type AnalyzeEmailRequest } from '../lib/v1/models/AnalyzeEmailRequest'; | ||
export { type IPInsightsConfiguration, IPInsights } from './ipInsights'; | ||
export { IPInsights } from './ipInsights'; | ||
export { type AnalyzeIpRequest } from '../lib/v1/models/AnalyzeIpRequest'; | ||
export { type Configuration } from '../lib/v1/runtime'; | ||
export { type ErrorResponse } from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
import { AnalyzeIpRequest } from '../lib/v1/models/AnalyzeIpRequest'; | ||
export type IPInsightsConfiguration = { | ||
apiKey: string; | ||
version: string; | ||
basePath?: string; | ||
}; | ||
export declare class IPInsights { | ||
@@ -8,0 +3,0 @@ private ipInsightsApi; |
@@ -15,8 +15,14 @@ "use strict"; | ||
async analyze(request) { | ||
return this.ipInsightsApi.analyzeIp({ | ||
analyzeIpRequest: { | ||
ip: request.ip, | ||
enableAI: request.enableAI, | ||
} | ||
}); | ||
try { | ||
return await this.ipInsightsApi.analyzeIp({ | ||
analyzeIpRequest: { | ||
ip: request.ip, | ||
enableAI: request.enableAI, | ||
} | ||
}); | ||
} | ||
catch (error) { | ||
const errorResponse = await error.response.json(); | ||
throw errorResponse; | ||
} | ||
} | ||
@@ -23,0 +29,0 @@ ; |
import { AnalyzeEmailRequest } from '../lib/v1/models/AnalyzeEmailRequest'; | ||
export type EmailInsightsConfiguration = { | ||
apiKey: string; | ||
version: string; | ||
basePath?: string; | ||
}; | ||
export declare class EmailInsights { | ||
@@ -8,0 +3,0 @@ private emailInsightsApi; |
@@ -12,9 +12,15 @@ import { EmailInsightsApi } from '../lib/v1/apis/EmailInsightsApi'; | ||
async analyze(request) { | ||
return this.emailInsightsApi.analyzeEmail({ | ||
analyzeEmailRequest: { | ||
email: request.email, | ||
enableAutoCorrection: request.enableAutoCorrection, | ||
enableAI: request.enableAI, | ||
} | ||
}); | ||
try { | ||
return await this.emailInsightsApi.analyzeEmail({ | ||
analyzeEmailRequest: { | ||
email: request.email, | ||
enableAutoCorrection: request.enableAutoCorrection, | ||
enableAI: request.enableAI, | ||
} | ||
}); | ||
} | ||
catch (error) { | ||
const errorResponse = await error.response.json(); | ||
throw errorResponse; | ||
} | ||
} | ||
@@ -21,0 +27,0 @@ ; |
@@ -1,5 +0,7 @@ | ||
export { type EmailInsightsConfiguration, EmailInsights } from './emailInsights'; | ||
export { EmailInsights } from './emailInsights'; | ||
export { type AnalyzeEmailRequest } from '../lib/v1/models/AnalyzeEmailRequest'; | ||
export { type IPInsightsConfiguration, IPInsights } from './ipInsights'; | ||
export { IPInsights } from './ipInsights'; | ||
export { type AnalyzeIpRequest } from '../lib/v1/models/AnalyzeIpRequest'; | ||
export { type Configuration } from '../lib/v1/runtime'; | ||
export { type ErrorResponse } from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
import { AnalyzeIpRequest } from '../lib/v1/models/AnalyzeIpRequest'; | ||
export type IPInsightsConfiguration = { | ||
apiKey: string; | ||
version: string; | ||
basePath?: string; | ||
}; | ||
export declare class IPInsights { | ||
@@ -8,0 +3,0 @@ private ipInsightsApi; |
@@ -12,8 +12,14 @@ import { IPInsightsApi } from '../lib/v1/apis/IPInsightsApi'; | ||
async analyze(request) { | ||
return this.ipInsightsApi.analyzeIp({ | ||
analyzeIpRequest: { | ||
ip: request.ip, | ||
enableAI: request.enableAI, | ||
} | ||
}); | ||
try { | ||
return await this.ipInsightsApi.analyzeIp({ | ||
analyzeIpRequest: { | ||
ip: request.ip, | ||
enableAI: request.enableAI, | ||
} | ||
}); | ||
} | ||
catch (error) { | ||
const errorResponse = await error.response.json(); | ||
throw errorResponse; | ||
} | ||
} | ||
@@ -20,0 +26,0 @@ ; |
@@ -5,3 +5,3 @@ { | ||
"description": "Opportify SDK for NodeJs", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "Apache-2.0", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -31,18 +31,23 @@ # Opportify-SDK-NodeJS | ||
``` | ||
const { EmailInsights } = require('@opportify/sdk-nodejs'); | ||
import { EmailInsights } from '@opportify/sdk-nodejs'; | ||
const emailInsights = new EmailInsights({ | ||
const clientEmailInsights = new EmailInsights({ | ||
version: '1.0', | ||
apiKey: 'YOUR-API-KEY-HERE' | ||
apiKey: 'YOUR_API_KEY' | ||
}); | ||
emailInsights.analyze({ | ||
email: 'your-test@email.domain.com', | ||
enableAutoCorrection: true, | ||
enableAI: true // only available for paid plans. | ||
}).then(response => { | ||
console.log(response); | ||
}).catch(error => { | ||
console.error(error); | ||
}); | ||
async function analyzeEmail() { | ||
try { | ||
const response = await clientEmailInsights.analyze({ | ||
email: "email_to_validate@domain.com", | ||
enableAutoCorrection: true, | ||
enableAI: true, // only available on paid plans. | ||
}); | ||
console.log('response', response); | ||
} catch (error: unknown) { | ||
console.error('error', error); | ||
} | ||
} | ||
analyzeEmail(); | ||
``` | ||
@@ -53,5 +58,5 @@ | ||
``` | ||
const { IPInsights } = require('@opportify/sdk-nodejs'); | ||
import { IPInsights } from '@opportify/sdk-nodejs'; | ||
const ipInsights = new IPInsights({ | ||
const clientIpInsights = new IPInsights({ | ||
version: '1.0', | ||
@@ -61,10 +66,15 @@ apiKey: 'YOUR-API-KEY-HERE' | ||
ipInsights.analyze({ | ||
ip: '8.8.8.8', | ||
enableAI: true // only available for paid plans. | ||
}).then(response => { | ||
console.log(response); | ||
}).catch(error => { | ||
console.error(error); | ||
}); | ||
async function analyzeIP() { | ||
try { | ||
const response = await clientIpInsights.analyze({ | ||
ip: '8.8.8.8', | ||
enableAI: true // only available for paid plans. | ||
}); | ||
console.log('response', response); | ||
} catch (error: unknown) { | ||
console.error('error', error); | ||
} | ||
} | ||
analyzeIP(); | ||
``` | ||
@@ -71,0 +81,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1028637
324
9963
85