import { google } from 'googleapis';
export default defineComponent({
props: {
google_perspective: {
type: "app",
app: "google_perspective",
}
},
async run({ steps, $ }) {
const client = await google.discoverAPI("https://commentanalyzer.googleapis.com/$discovery/rest?version=v1alpha1");
const analyzeRequest = {
comment: {
text: 'Jiminy cricket! Well gosh durned it! Oh damn it all!',
},
requestedAttributes: {
TOXICITY: {},
},
};
return await client.comments.analyze({
key: this.google_perspective.$auth.api_key,
resource: analyzeRequest,
});
},
})
Google Perspective uses API keys for authentication. When you connect your Google Perspective account, Pipedream securely stores the keys so you can easily authenticate to Google Perspective APIs in both code and no-code steps.