/**
* Function to get video settings for a specific camera on the Meraki Dashboard.
*
* @param {Object} args - Arguments for the request.
* @param {string} args.serial - The serial number of the camera (required).
* @returns {Promise<Object>} - The video settings for the specified camera.
*/
const executeFunction = async ({ serial }) => {
const baseUrl = 'https://api.meraki.com/api/v1';
const token = process.env.CISCO_MERAKI_S_PUBLIC_WORKSPACE_API_KEY;
try {
// Construct the URL with the serial number
const url = `${baseUrl}/devices/${serial}/camera/video/settings`;
// Set up headers for the request
const headers = {
'Accept': 'application/json',
'Authorization': `Bearer ${token}`
};
// Perform the fetch request
const response = await fetch(url, {
method: 'GET',
headers
});
// Check if the response was successful
if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData);
}
// Parse and return the response data
const data = await response.json();
return data;
} catch (error) {
console.error('Error getting camera video settings:', error);
return { error: 'An error occurred while getting camera video settings.' };
}
};
/**
* Tool configuration for getting camera video settings on the Meraki Dashboard.
* @type {Object}
*/
const apiTool = {
function: executeFunction,
definition: {
type: 'function',
function: {
name: 'getDeviceCameraVideoSettings',
description: 'Get video settings for a specific camera on the Meraki Dashboard.',
parameters: {
type: 'object',
properties: {
serial: {
type: 'string',
description: 'The serial number of the camera.'
}
},
required: ['serial']
}
}
}
};
export { apiTool };