with Azure DevOps (Microsoft Entra ID OAuth) and BitMEX?
Emit new event for the specified event type.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
azure_devops_microsoft_entra_id_oauth: {
type: "app",
app: "azure_devops_microsoft_entra_id_oauth",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://dev.azure.com/${this.azure_devops_microsoft_entra_id_oauth.$auth.organization}/_apis/projects`,
headers: {
Authorization: `Bearer ${this.azure_devops_microsoft_entra_id_oauth.$auth.oauth_access_token}`,
"content-type": `application/json`,
},
params: {
"api-version": `7.1`,
},
})
},
})
import crypto from "crypto";
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
bitmex: {
type: "app",
app: "bitmex",
}
},
async run({ steps, $ }) {
// Set verb, path, and data as needed
const verb = "GET";
const path = "/api/v1/user";
const expires = Math.floor(Date.now() / 1000) + 60; // UNIX timestamp in seconds
const data = ""; // No body for GET
// Function to generate signature
function generateSignature(apiSecret, verb, path, expires, data) {
const message = verb + path + expires + data;
return crypto
.createHmac("sha256", apiSecret)
.update(message)
.digest("hex");
}
// Build headers
const signature = generateSignature(
this.bitmex.$auth.api_secret,
verb,
path,
expires,
data
);
const headers = {
"api-key": this.bitmex.$auth.api_key,
"api-expires": expires,
"api-signature": signature,
};
// Perform request
return await axios($, {
method: verb,
url: `${this.bitmex.$auth.api_url}${path}`,
headers,
});
},
})