Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 0 additions & 92 deletions javascript/bookmarks/bookmarks-lookup-js-sdk.js

This file was deleted.

93 changes: 0 additions & 93 deletions javascript/bookmarks/create-bookmark-js-sdk.js

This file was deleted.

91 changes: 0 additions & 91 deletions javascript/bookmarks/delete-bookmark-js-sdk.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
const needle = require('needle');
const { Client } = require('@xdevplatform/xdk');

// The code below sets the bearer token from your environment variables
// To set environment variables on macOS or Linux, run the export command below from the terminal:
// export BEARER_TOKEN='YOUR-TOKEN'
const token = process.env.BEARER_TOKEN;

const endpointUrl = 'https://api.x.com/2/compliance/jobs'
const client = new Client({ bearerToken: token });

// For User Compliance Job, replace type value with users instead of tweets
// Also replace the name value with your desired job name
const data = {
"type": "tweets",
"name": 'my_batch_compliance_job'
}

async function makeRequest() {

const res = await needle.post(endpointUrl, {
json: data,
headers: {
"User-Agent": "v2BatchComplianceJS",
"authorization": `Bearer ${token}`
}
})

if (res.body) {
return res.body;
} else {
throw new Error('Unsuccessful request');
}
}
type: "tweets",
name: 'my_batch_compliance_job'
};

(async () => {
try {
// Make request
const response = await makeRequest();
const response = await client.compliance.createJobs(data);

console.dir(response, {
depth: null
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const needle = require('needle');

// Replace with your job download_url
downloadUrl = ''

async function getRequest() {
const res = await fetch(downloadUrl, {
headers: {
'Accept-Encoding': 'gzip, deflate, br'
}
})

const res = await needle('get', downloadUrl, { compressed: true })

if (res.body) {
return res.body.toString('utf8');
if (res.ok) {
return await res.text();
} else {
throw new Error('Unsuccessful request');
}
Expand All @@ -28,4 +29,4 @@ async function getRequest() {
process.exit(-1);
}
process.exit();
})();
})();
Loading
Loading