@smartsheet/smar-mcp
Version:
A Model Context Protocol (MCP) server for interacting with the Smartsheet API. This server provides tools for searching, retrieving, and updating Smartsheet sheets through the MCP protocol.
71 lines (70 loc) • 2.33 kB
JavaScript
export class SmartsheetDiscussionAPI {
api;
constructor(api) {
this.api = api;
}
/**
* Get discussions by sheet ID
* @param sheetId Sheet ID
* @param include Optional parameter to include additional information (e.g., 'attachments')
* @param pageSize Number of discussions to return per page
* @param page Page number to return
* @param includeAll Whether to include all results
* @returns Discussions data
*/
async getDiscussionsBySheetId(sheetId, include, pageSize, page, includeAll) {
return this.api.request('GET', `/sheets/${sheetId}/discussions`, undefined, {
include,
pageSize,
page,
includeAll,
});
}
/**
* Get discussions by row ID
* @param sheetId Sheet ID
* @param rowId Row ID
* @param include Optional parameter to include additional information (e.g., 'attachments')
* @param pageSize Number of discussions to return per page
* @param page Page number to return
* @param includeAll Whether to include all results
* @returns Discussions data
*/
async getDiscussionsByRowId(sheetId, rowId, include, pageSize, page, includeAll) {
return this.api.request('GET', `/sheets/${sheetId}/rows/${rowId}/discussions`, undefined, {
include,
pageSize,
page,
includeAll,
});
}
/**
* Create a discussion on a sheet
* @param sheetId Sheet ID
* @param commentText Text of the comment to add
* @returns Created discussion data
*/
async createSheetDiscussion(sheetId, commentText) {
const data = {
comment: {
text: commentText
}
};
return this.api.request('POST', `/sheets/${sheetId}/discussions`, data);
}
/**
* Create a discussion on a row
* @param sheetId Sheet ID
* @param rowId Row ID
* @param commentText Text of the comment to add
* @returns Created discussion data
*/
async createRowDiscussion(sheetId, rowId, commentText) {
const data = {
comment: {
text: commentText
}
};
return this.api.request('POST', `/sheets/${sheetId}/rows/${rowId}/discussions`, data);
}
}