Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
// Set CONTENT_MODERATOR_SUBSCRIPTION_KEY and CONTENT_MODERATOR_ENDPOINT in your environment variables.
let credentials = new auth.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env['CONTENT_MODERATOR_SUBSCRIPTION_KEY'] } });
let client = new ContentModerator.ContentModeratorClient(process.env['CONTENT_MODERATOR_ENDPOINT'], credentials);
/**
* END - Authenticate
*/
/**
* AUTHENTICATE - HUMAN REVIEWS
* To create a human review, a special client is needed due to a unique subscription key.
* Get the key from the Content Moderator website: go to the gear symbol (settings) --> Credentials --> Ocp-Apim-Subscription-Key
*/
// Set CONTENT_MODERATOR_SUBSCRIPTION_KEY and CONTENT_MODERATOR_ENDPOINT in your environment variables.
let credentialsReviews = new auth.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env['CONTENT_MODERATOR_REVIEWS_KEY'] } });
let clientReviews = new ContentModerator.ContentModeratorClient(process.env['CONTENT_MODERATOR_ENDPOINT'], credentialsReviews);
/**
* END - Authenticate Human Reviews
*/
async function main() {
console.log('\n##############################################################################\n')
/**
* IMAGE MODERATION
* This example will moderate URL images.
*/
console.log('IMAGE MODERATION')
console.log()
// Moderate racy content
// Human Reviews - Images variables
// Set your callback endpoint in your environment variables with your own region.
// For example: 'https://westus.api.cognitive.microsoft.com/contentmoderator/review/v1.0'.
let callbackEndpoint = process.env['CONTENT_MODERATOR_REVIEWS_ENDPOINT']
// The team name you used when you created an account at the Content Moderator website
const TEAM_NAME = process.env['CONTENT_MODERATOR_TEAM_NAME']
// Time to wait for processing the review (in milliseconds)
const TIME_TO_SLEEP = 45000;
/**
* AUTHENTICATE
* Using your subscription key and endpoint, a client is created that is used call the API.
*/
// Set CONTENT_MODERATOR_SUBSCRIPTION_KEY and CONTENT_MODERATOR_ENDPOINT in your environment variables.
let credentials = new auth.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env['CONTENT_MODERATOR_SUBSCRIPTION_KEY'] } });
let client = new ContentModerator.ContentModeratorClient(process.env['CONTENT_MODERATOR_ENDPOINT'], credentials);
/**
* END - Authenticate
*/
/**
* AUTHENTICATE - HUMAN REVIEWS
* To create a human review, a special client is needed due to a unique subscription key.
* Get the key from the Content Moderator website: go to the gear symbol (settings) --> Credentials --> Ocp-Apim-Subscription-Key
*/
// Set CONTENT_MODERATOR_SUBSCRIPTION_KEY and CONTENT_MODERATOR_ENDPOINT in your environment variables.
let credentialsReviews = new auth.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env['CONTENT_MODERATOR_REVIEWS_KEY'] } });
let clientReviews = new ContentModerator.ContentModeratorClient(process.env['CONTENT_MODERATOR_ENDPOINT'], credentialsReviews);
/**
* END - Authenticate Human Reviews
*/