import Roark from '@roarkanalytics/sdk';
const client = new Roark({
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});
const response = await client.metric.listDefinitions();
console.log(response.data);{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"variantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"versionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"calculationType": "PROVIDER",
"type": "COUNT",
"scope": "GLOBAL",
"supportedContexts": [
"CALL"
],
"unit": {
"name": "<string>",
"symbol": "<string>"
},
"threshold": {
"sourceMetricDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operator": "GREATER_THAN",
"thresholdValue": "<string>",
"aggregationMode": "EACH",
"countThreshold": 123,
"sourceParticipantRole": "AGENT",
"sourceVariantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"formula": {
"expression": "<string>",
"sources": [
{
"sourceMetricDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceVariantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
},
"pattern": {
"operation": "PATTERN_EXISTS",
"windowMode": "<string>",
"triggerCombinator": "AND",
"triggers": [
{
"sourceMetricDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operator": "GREATER_THAN",
"thresholdValue": "<string>",
"sourceParticipantRole": "AGENT",
"sourceVariantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"outcome": {
"sourceMetricDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operator": "GREATER_THAN",
"thresholdValue": "<string>",
"sourceParticipantRole": "AGENT",
"sourceVariantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"windowBefore": 123,
"windowAfter": 123
}
}
}
]
}Fetch all metric definitions available in the project, including both system-generated and custom metrics.
import Roark from '@roarkanalytics/sdk';
const client = new Roark({
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});
const response = await client.metric.listDefinitions();
console.log(response.data);{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"variantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"versionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"calculationType": "PROVIDER",
"type": "COUNT",
"scope": "GLOBAL",
"supportedContexts": [
"CALL"
],
"unit": {
"name": "<string>",
"symbol": "<string>"
},
"threshold": {
"sourceMetricDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operator": "GREATER_THAN",
"thresholdValue": "<string>",
"aggregationMode": "EACH",
"countThreshold": 123,
"sourceParticipantRole": "AGENT",
"sourceVariantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"formula": {
"expression": "<string>",
"sources": [
{
"sourceMetricDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceVariantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
},
"pattern": {
"operation": "PATTERN_EXISTS",
"windowMode": "<string>",
"triggerCombinator": "AND",
"triggers": [
{
"sourceMetricDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operator": "GREATER_THAN",
"thresholdValue": "<string>",
"sourceParticipantRole": "AGENT",
"sourceVariantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"outcome": {
"sourceMetricDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operator": "GREATER_THAN",
"thresholdValue": "<string>",
"sourceParticipantRole": "AGENT",
"sourceVariantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"windowBefore": 123,
"windowAfter": 123
}
}
}
]
}Documentation Index
Fetch the complete documentation index at: https://docs.roark.ai/llms.txt
Use this file to discover all available pages before exploring further.