//native
/**
* Get Data from Dataset
* Use this resource to request data from the specified dataset.
*/
export async function main(auth: RT.BambooHr, datasetName: string, body: Body) {
const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/datasets/${datasetName}`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
fields: string[]
aggregations?: {
field?: string
aggregation?: 'count' | 'sum' | 'avg' | 'min' | 'max'
[k: string]: unknown
}[]
sortBy?: {
field?: string
sort?: 'asc' | 'desc'
[k: string]: unknown
}[]
filters?: {
match?: string
filters?: {
field?: string
operator?:
| 'contains'
| 'does_not_contain'
| 'equal'
| 'not_equal'
| 'empty'
| 'not_empty'
| 'lt'
| 'lte'
| 'gt'
| 'gte'
| 'last'
| 'next'
| 'range'
| 'checked'
| 'not_checked'
| 'includes'
| 'does_not_include'
value?: unknown
[k: string]: unknown
}[]
[k: string]: unknown
}
groupBy?: string[]
[k: string]: unknown
}
Submitted by hugo697 235 days ago