Add query parameters as key-value pairs
Add headers as key-value pairs
async
(params, auths) => {
}
const config = {
method: params.method,
url: params.url,
params: params.query,
headers: params.headers,
responseType: params.responseType,
data: params.data,
}
if (params.auth) config.auth = params.auth
return await require("@pipedreamhq/platform").axios(this, config)
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const query = steps.trigger.event.body.query
const regex = /(?<=id:)[^ \)]+/g
return query.match(regex)
auths
objectAdd headers as key-value pairs
Data to be sent as the request body
return
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params, auths) => {
}
const config = {
method: params.method,
url: params.url,
headers: params.headers,
responseType: params.responseType,
data: params.data,
}
let response = []
if (config.data.query) {
response = await require("@pipedreamhq/platform").axios(this, config)
}
console.log("Found these access profiles: " + response.map(x=> x.name).join(", "))
return response.map(x=> x.id)
auths
objectAdd headers as key-value pairs
Data to be sent as the request body
return
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params) => {
}
const config = {
method: params.method,
url: params.url,
params: params.query,
headers: params.headers,
responseType: params.responseType,
data: params.data,
}
let response = []
if (config.data.query) {
response = await require("@pipedreamhq/platform").axios(this, config)
}
console.log("Found these roles: " + response.map(x=> x.name).join(", "))
return response.map(x=> x.id)
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
let constraints = []
if (steps.get_entitlements.$return_value.length > 0) {
constraints.push({
type: "ENTITLEMENT",
ids: steps.get_entitlements.$return_value,
operator: "SELECTED"
})
}
if (steps.get_access_profiles.$return_value.length > 0) {
constraints.push({
type: "ACCESS_PROFILE",
ids: steps.get_access_profiles.$return_value,
operator: "SELECTED"
})
}
if (steps.get_roles.$return_value.length > 0) {
constraints.push({
type: "ROLE",
ids: steps.get_roles.$return_value,
operator: "SELECTED"
})
}
return constraints
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params) => {
}
const { days } = params
const deadline = new Date();
deadline.setDate(new Date().getDate() + params.days);
return deadline.toISOString();
$end("Stop")
async
params => {
}
await new Promise(resolve => setTimeout(resolve, params.ms || 0))
auths
objectAdd headers as key-value pairs
Data to be sent as the request body
return
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params) => {
}
const config = {
method: params.method,
url: params.url,
params: params.query,
headers: params.headers,
responseType: params.responseType,
data: params.data,
}
return await require("@pipedreamhq/platform").axios(this, config)
async
params => {
}
await new Promise(resolve => setTimeout(resolve, params.ms || 0))
auths
objectAdd headers as key-value pairs
return
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params, auths) => {
}
const { retries } = params
const { pause } = params
const config = {
method: params.method,
url: params.url,
params: params.query,
headers: params.headers,
responseType: params.responseType,
data: params.data,
}
let countdown = params.retries
while (true) {
try {
return await require("@pipedreamhq/platform").axios(this, config)
} catch (e) {
if (countdown > 0) {
countdown--
console.log("Failed to activate campaign. Retrying...")
await new Promise(resolve => setTimeout(resolve, params.pause || 0))
} else {
throw e
}
}
}