UNPKG

@goparrot/franchise-mcp-server

Version:

MCP Server for Franchise API

200 lines (199 loc) 5.81 kB
import { dashboardBaseUrl, makeRequest } from '../../common/index.js'; /** * Method information for dashboard promotion endpoints */ export const PromotionMethods = { list: { description: 'List all promotions for a merchant', method: 'get', path: '/promotions/api/v2/merchants/{merchantId}/promotions', pathParams: [ { name: 'merchantId', type: 'string', description: 'Merchant ID', required: true, }, ], queryParams: [ { name: 'type', type: 'array', description: 'Filter promotions by type', required: false, }, ], requestType: 'ListPromotionsRequest', isMultipart: false, originalName: 'list', isWrite: false, permissions: ['promotion:api:read'], }, get: { description: 'Get a specific promotion by UUID', method: 'get', path: '/promotions/api/v2/merchants/{merchantId}/promotions/{uuid}', pathParams: [ { name: 'merchantId', type: 'string', description: 'Merchant ID', required: true, }, { name: 'uuid', type: 'string', description: 'Promotion UUID', required: true, }, ], queryParams: [], requestType: 'GetPromotionRequest', isMultipart: false, originalName: 'get', isWrite: false, permissions: ['promotion:api:read'], }, getMany: { description: 'Get multiple promotions by their UUIDs', method: 'get', path: '/promotions/api/v2/merchants/{merchantId}/promotions/many', pathParams: [ { name: 'merchantId', type: 'string', description: 'Merchant ID', required: true, }, ], queryParams: [ { name: 'promotions', type: 'array', description: 'Array of promotion UUIDs', required: true, }, ], requestType: 'GetManyPromotionsRequest', isMultipart: false, originalName: 'getMany', isWrite: false, permissions: ['promotion:api:read'], }, create: { description: 'Create a new promotion', method: 'post', path: '/promotions/api/v2/merchants/{merchantId}/promotions', pathParams: [ { name: 'merchantId', type: 'string', description: 'Merchant ID', required: true, }, ], queryParams: [], requestType: 'CreatePromotionRequest', isMultipart: false, originalName: 'create', isWrite: true, permissions: ['promotion:api:create'], }, update: { description: 'Update an existing promotion', method: 'put', path: '/promotions/api/v2/merchants/{merchantId}/promotions/{uuid}', pathParams: [ { name: 'merchantId', type: 'string', description: 'Merchant ID', required: true, }, { name: 'uuid', type: 'string', description: 'Promotion UUID', required: true, }, ], queryParams: [], requestType: 'UpdatePromotionRequest', isMultipart: false, originalName: 'update', isWrite: true, permissions: ['promotion:api:update'], }, delete: { description: 'Delete a promotion', method: 'delete', path: '/promotions/api/v2/merchants/{merchantId}/promotions/{uuid}', pathParams: [ { name: 'merchantId', type: 'string', description: 'Merchant ID', required: true, }, { name: 'uuid', type: 'string', description: 'Promotion UUID', required: true, }, ], queryParams: [], requestType: 'DeletePromotionRequest', isMultipart: false, originalName: 'delete', isWrite: true, permissions: ['promotion:api:delete'], }, }; /** * Handlers for dashboard promotion endpoints */ export const PromotionHandlers = { list: async (accessToken, args) => { return makeRequest(PromotionMethods.list, { baseUrl: dashboardBaseUrl, accessToken, args, }); }, get: async (accessToken, args) => { return makeRequest(PromotionMethods.get, { baseUrl: dashboardBaseUrl, accessToken, args, }); }, getMany: async (accessToken, args) => { return makeRequest(PromotionMethods.getMany, { baseUrl: dashboardBaseUrl, accessToken, args, }); }, create: async (accessToken, args) => { return makeRequest(PromotionMethods.create, { baseUrl: dashboardBaseUrl, accessToken, args, }); }, update: async (accessToken, args) => { return makeRequest(PromotionMethods.update, { baseUrl: dashboardBaseUrl, accessToken, args, }); }, delete: async (accessToken, args) => { return makeRequest(PromotionMethods.delete, { baseUrl: dashboardBaseUrl, accessToken, args, }); }, };