Skip to content

Instantly share code, notes, and snippets.

View cfjedimaster's full-sized avatar
😺
Happy, and tired.

Raymond Camden cfjedimaster

😺
Happy, and tired.
View GitHub Profile
{
"type":"CALLBACK",
"data": {
"url":"your webhook url",
"headers": {
"cats":"rule",
"dogs":"drool"
}
}
}
async function createPDFJob(asset, webhook, token, clientId) {
let body = {
'assetID': asset.assetID,
'documentLanguage': 'en-US',
'notifiers': [
{
'type':'CALLBACK',
'data':{
'url':webhook,
{
host: '3b63-76-72-10-106.ngrok-free.app',
'user-agent': 'Jersey/2.35 (HttpUrlConnection 11.0.15)',
'content-length': '1146',
accept: 'application/json',
cats: '2024-01-25T19:35:57.498Z',
'content-type': 'application/json',
traceparent: '00-e8118852197c45fe95d826aead4245a4-e5d4daf5c4f2b701-00',
'uber-trace-id': 'e8118852197c45fe95d826aead4245a4:e5d4daf5c4f2b701:0:0',
'x-forwarded-for': '52.3.160.9',
<cfscript>
function aiSummarize(str) {
var body = {
"contents": [
{
"parts": [
{
"text": "Summarize the following text into two to three sentences:\n\n#arguments.str#"
}
]
let url = 'http://apps.lafayettela.gov/L911/WebService1.asmx/getCurrentTrafficConditions';
let resp = await fetch(url, {
method:'POST',
headers: {
'Content-Type':'application/json'
}
});
let result = await resp.json();
let data = JSON.parse(result.d);
console.log(data);
async function getAccessToken(id, secret) {
const params = new URLSearchParams();
params.append('client_id', id);
params.append('client_secret', secret);
let resp = await fetch('https://pdf-services-ue1.adobe.io/token', {
method: 'POST',
headers: {
'Content-Type':'application/x-www-form-urlencoded'
async function getUploadData(mediaType, token, clientId) {
let body = {
'mediaType': mediaType
};
body = JSON.stringify(body);
let req = await fetch(REST_API+'assets', {
method:'post',
headers: {
async function uploadFile(url, filePath, mediaType) {
let stream = fs.createReadStream(filePath);
let stats = fs.statSync(filePath);
let fileSizeInBytes = stats.size;
let upload = await fetch(url, {
method:'PUT',
redirect:'follow',
headers: {
async function accessibilityCheckerJob(asset, token, clientId) {
let body = {
'assetID': asset.assetID
}
let resp = await fetch(REST_API + 'operation/accessibilitychecker', {
method: 'POST',
headers: {
'Authorization':`Bearer ${token}`,
'X-API-KEY':clientId,
async function delay(x) {
return new Promise(resolve => {
setTimeout(() => resolve(), x);
});
}
async function pollJob(url, token, clientId) {
let status = null;
let asset;