@goparrot/franchise-mcp-server
Version:
MCP Server for Franchise API
149 lines (148 loc) • 4.23 kB
JavaScript
import { dashboardBaseUrl, makeRequest } from '../../common/index.js';
/**
* Method information for dashboard web store endpoints
*/
export const WebStoreMethods = {
get: {
description: 'Get web store configuration',
method: 'get',
path: '/webstore/api/v2/web-stores/{storeId}',
pathParams: [
{
name: 'storeId',
type: 'string',
description: 'Store ID',
required: true,
},
],
queryParams: [
{
name: 'mergedWithWebMerchant',
type: 'boolean',
description: 'Include merchant configuration',
required: true,
},
],
requestType: 'GetWebStoreRequest',
isMultipart: false,
originalName: 'get',
isWrite: false,
permissions: ['store:api:read'],
},
patch: {
description: 'Update web store configuration',
method: 'patch',
path: '/webstore/api/v2/web-stores/{storeId}',
pathParams: [
{
name: 'storeId',
type: 'string',
description: 'Store ID',
required: true,
},
],
queryParams: [],
requestType: 'PatchWebStoreRequest',
isMultipart: false,
originalName: 'patch',
isWrite: true,
permissions: ['store:api:update'],
},
getUrls: {
description: 'Get web store URLs',
method: 'get',
path: '/webstore/api/v2/web-stores/{storeId}/urls',
pathParams: [
{
name: 'storeId',
type: 'string',
description: 'Store ID',
required: true,
},
],
queryParams: [
{
name: 'userId',
type: 'string',
description: 'User ID',
required: false,
},
],
requestType: 'GetWebStoreUrlsRequest',
isMultipart: false,
originalName: 'getUrls',
isWrite: false,
permissions: ['store:api:read'],
},
list: {
description: 'List web stores for a merchant',
method: 'get',
path: '/webstore/api/v2/web-stores',
pathParams: [],
queryParams: [
{
name: 'merchantId',
type: 'string',
description: 'Merchant ID',
required: true,
},
],
requestType: 'ListWebStoresRequest',
isMultipart: false,
originalName: 'list',
isWrite: false,
permissions: ['store:api:read'],
},
setStyle: {
description: 'Replace web store style configuration',
method: 'post',
path: '/webstore/api/v2/web-stores/styles/replace',
pathParams: [],
queryParams: [],
requestType: 'SetWebStoreStyleRequest',
isMultipart: false,
originalName: 'setStyle',
isWrite: true,
permissions: ['store:api:update', 'webstore:default-style:apply'],
},
};
/**
* Handlers for dashboard web store endpoints
*/
export const WebStoreHandlers = {
get: async (accessToken, args) => {
return makeRequest(WebStoreMethods.get, {
baseUrl: dashboardBaseUrl,
accessToken,
args,
});
},
patch: async (accessToken, args) => {
return makeRequest(WebStoreMethods.patch, {
baseUrl: dashboardBaseUrl,
accessToken,
args,
});
},
getUrls: async (accessToken, args) => {
return makeRequest(WebStoreMethods.getUrls, {
baseUrl: dashboardBaseUrl,
accessToken,
args,
});
},
list: async (accessToken, args) => {
return makeRequest(WebStoreMethods.list, {
baseUrl: dashboardBaseUrl,
accessToken,
args,
});
},
setStyle: async (accessToken, args) => {
return makeRequest(WebStoreMethods.setStyle, {
baseUrl: dashboardBaseUrl,
accessToken,
args,
});
},
};