diff --git a/.github/workflows/npm-publish-beta.yml b/.github/workflows/npm-publish-beta.yml index 9d778a2..80fc913 100644 --- a/.github/workflows/npm-publish-beta.yml +++ b/.github/workflows/npm-publish-beta.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: '20.x' registry-url: 'https://registry.npmjs.org' - name: Install dependencies @@ -32,13 +32,16 @@ jobs: # Get the current version from package.json CURRENT_VERSION=$(node -p "require('./package.json').version") + # Generate a timestamp for uniqueness + TIMESTAMP=$(date +"%Y%m%d%H%M%S") + # For PR: use PR number in version if [[ "${{ github.event_name }}" == "pull_request" ]]; then - BETA_VERSION="$CURRENT_VERSION-beta.pr.${{ github.event.pull_request.number }}" + BETA_VERSION="$CURRENT_VERSION-beta.pr.${{ github.event.pull_request.number }}.$TIMESTAMP" else # For develop: use commit hash SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7) - BETA_VERSION="$CURRENT_VERSION-beta.$SHORT_SHA" + BETA_VERSION="$CURRENT_VERSION-beta.$SHORT_SHA.$TIMESTAMP" fi # Set output for use in next step @@ -51,3 +54,22 @@ jobs: run: npm publish --tag beta --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Comment on PR with published version + if: github.event_name == 'pull_request' + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const version = process.env.BETA_VERSION; + const packageName = '@space48/sdm'; + const installCmd = `npm install ${packageName}@${version}`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `🚀 Beta version published: **${version}**\n\nYou can install this version with:\n\`\`\`bash\n${installCmd}\n\`\`\`` + }); + env: + BETA_VERSION: ${{ steps.beta-version.outputs.version }} diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 9910744..6b09cdb 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -14,7 +14,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: '20.x' registry-url: 'https://registry.npmjs.org' - name: Install dependencies @@ -23,7 +23,48 @@ jobs: - name: Build run: npm run build + - name: Get package version + id: package-version + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + - name: Publish to npm run: npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Find related PRs and comment + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const version = process.env.PACKAGE_VERSION; + const packageName = '@space48/sdm'; + const installCmd = `npm install ${packageName}@${version}`; + + // Get the commit message to find PR number + const { data: commit } = await github.rest.repos.getCommit({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.sha + }); + + // Look for PR references in the commit message (like "Merge pull request #123") + const prMatch = commit.commit.message.match(/Merge pull request #(\d+)/i); + + if (prMatch && prMatch[1]) { + const prNumber = parseInt(prMatch[1], 10); + + // Comment on the PR + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: `🚀 New version published: **${version}**\n\nThis version has been published to npm and is now available.\n\nYou can install it with:\n\`\`\`bash\n${installCmd}\n\`\`\`` + }); + + console.log(`Commented on PR #${prNumber} about the new release ${version}`); + } else { + console.log('No PR reference found in the commit message. Skipping comment.'); + } + env: + PACKAGE_VERSION: ${{ steps.package-version.outputs.version }} diff --git a/.gitignore b/.gitignore index c2ad828..c49f9e4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules .npmrc /scratch package-lock.json +/lib diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20 diff --git a/README.md b/README.md index 7e35db9..524c73d 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ packages, you must first configure the @space48 scope in npm. npm login --registry=https://npm.pkg.github.com --scope=@space48 ``` -### Enable node 14 +### Enable node 20 -sdm uses node 14. Use [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) to enable node 14: +sdm uses node 20. Use [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) to enable node 20: ```bash -nvm use 14 +nvm use 20 ``` diff --git a/lib/bin/generate-docs.d.ts b/lib/bin/generate-docs.d.ts deleted file mode 100644 index b798801..0000000 --- a/lib/bin/generate-docs.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -export {}; diff --git a/lib/bin/generate-docs.js b/lib/bin/generate-docs.js deleted file mode 100644 index 3e7f4cb..0000000 --- a/lib/bin/generate-docs.js +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env node -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const connectors_1 = require("../connectors"); -const fs_1 = require("fs"); -const path_1 = __importDefault(require("path")); -const docgen_1 = require("../framework/docgen"); -const docsDir = path_1.default.join(path_1.default.dirname(path_1.default.dirname(__dirname)), "docs"); -function main() { - const connectorsDocsDir = docsDir; - let summaryMarkdown = ""; - Object.entries(connectors_1.regularConnectors).forEach(([name, connector]) => { - const connectorDocsDir = path_1.default.join(connectorsDocsDir, hyphenate(name)); - ensureDirExists(connectorDocsDir); - const cliDocPath = path_1.default.join(connectorDocsDir, "reference.md"); - fs_1.writeFileSync(cliDocPath, docgen_1.Markdown.explainUsage(connector.$definition, name)); - summaryMarkdown = summaryMarkdown.concat(docgen_1.Markdown.explainSummary(connector.$definition, name)); - }); - fs_1.writeFileSync(path_1.default.join(docsDir, "summary.md"), summaryMarkdown); -} -function ensureDirExists(path) { - if (!fs_1.existsSync(path)) { - fs_1.mkdirSync(path, { recursive: true }); - } -} -const hyphenate = (value) => value.replace(/([A-Z])/g, g => `-${g[0].toLowerCase()}`).replace(/_/g, "-"); -main(); diff --git a/lib/bin/sdm-watch.d.ts b/lib/bin/sdm-watch.d.ts deleted file mode 100644 index b798801..0000000 --- a/lib/bin/sdm-watch.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -export {}; diff --git a/lib/bin/sdm-watch.js b/lib/bin/sdm-watch.js deleted file mode 100644 index 6003a61..0000000 --- a/lib/bin/sdm-watch.js +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env node -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const watch_1 = require("../framework/watch"); -const cli_table3_1 = __importDefault(require("cli-table3")); -const readline_1 = __importDefault(require("readline")); -const chalk_1 = __importDefault(require("chalk")); -const duration_1 = __importDefault(require("duration")); -function main() { - process.stdin.pause(); - const progressLog = new ProgressLog(); - const stop = watch_1.listenForProgress(async (processes) => { - progressLog.apply(processes); - const output = progressLog - .getScopes() - .map(scope => ` ${chalk_1.default.red.underline.bold(scope)}\n\n${renderProgressTable(progressLog.getExecutions(scope))}`) - .join("\n\n"); - readline_1.default.cursorTo(process.stdout, 0, 0); - console.error(`Cursor`); - readline_1.default.clearScreenDown(process.stdout); - process.stdout.write(output + "\n"); - }); - process.once("SIGINT", () => { - stop(); - process.exit(); - }); -} -class ProgressLog { - constructor() { - this.data = new Map(); - } - apply(processes) { - const executionProgress = processes.map(({ executions }) => executions).flat(); - executionProgress.forEach(progress => { - const commandIdentifier = `${progress.pid}-${progress.executionId}`; - this.data.set(commandIdentifier, progress); - }); - } - getScopes() { - return distinct([...this.data.values()].map(commandProgress => commandProgress.scope)); - } - getExecutions(scope) { - return [...this.data.values()].filter(commandProgress => commandProgress.scope === scope); - } -} -function renderProgressTable(executions) { - const head = [ - "Command", - "Runtime", - "Items", - "RPM", - "RPM 10s", - "RPM 60s", - "RPM 5m", - "Start", - "Finish", - ]; - const table = new cli_table3_1.default({ head }); - const lines = executions.sort(compareExecutionsForSort).flatMap(execution => { - const runtimeMillis = execution.timestamp.getTime() - execution.startTime.getTime(); - const commandRows = execution.commands.flatMap(command => [ - `${command.command.endpoint} ${command.command.path}`, - formatDuration(execution.startTime, command.stats.timestamp), - command.stats.outputs, - computeRpm(command.stats.outputs, runtimeMillis), - computeRpm(command.stats.outputs10, Math.min(10000, runtimeMillis)), - computeRpm(command.stats.outputs60, Math.min(60000, runtimeMillis)), - computeRpm(command.stats.outputs300, Math.min(300000, runtimeMillis)), - formatTimestamp(execution.startTime), - execution.finishTime ? formatTimestamp(execution.finishTime) : "-", - ]); - console.error(`Command Rows: ${JSON.stringify(commandRows)}`); - const rows = [ - commandRows, - ["", { colSpan: head.length - 1, content: `↳ Error: ${execution.error}` }], - ]; - return execution.error ? rows : rows.slice(0, 1); - }); - console.error(`Lines: ${JSON.stringify(lines)}`); - table.push(...lines); - return table.toString(); -} -function compareExecutionsForSort(execution1, execution2) { - var _a, _b, _c, _d; - if (execution1.finishTime && !execution2.finishTime) { - return -1; - } - if (execution2.finishTime && !execution1.finishTime) { - return 1; - } - const command1ComparisonValue = (_b = (_a = execution1.finishTime) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : execution1.startTime.getTime(); - const command2ComparisonValue = (_d = (_c = execution2.finishTime) === null || _c === void 0 ? void 0 : _c.getTime()) !== null && _d !== void 0 ? _d : execution2.startTime.getTime(); - return command2ComparisonValue < command1ComparisonValue ? 1 : -1; -} -function formatTimestamp(timestamp) { - const isoString = timestamp.toISOString().split(".")[0]; - const isToday = timestamp.getFullYear() === Clock.now.getFullYear() && - timestamp.getMonth() === Clock.now.getMonth() && - timestamp.getDate() === Clock.now.getDate(); - return `${isToday ? isoString.split("T")[1] : isoString}Z`; -} -function formatDuration(from, to) { - const parts = new duration_1.default(from, to).toString(1).split(" "); - // remove ms part unless it's the only part - const partsToKeep = parts.length > 1 ? parts.slice(0, -1) : parts; - return partsToKeep.join(" "); -} -function computeRpm(count, durationMillis) { - const rpm = (60000 * count) / durationMillis; - return rpm >= 100 ? Math.round(rpm) : rpm.toPrecision(3); -} -class Clock { - static get now() { - if (!Clock.started) { - Clock._now = new Date(); - setInterval(() => (Clock._now = new Date()), 100); - Clock.started = true; - } - return Clock._now; - } -} -Clock.started = false; -main(); -function distinct(values) { - return [...new Set(values)]; -} diff --git a/lib/bin/sdm.d.ts b/lib/bin/sdm.d.ts deleted file mode 100644 index b798801..0000000 --- a/lib/bin/sdm.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -export {}; diff --git a/lib/bin/sdm.js b/lib/bin/sdm.js deleted file mode 100644 index 12eec28..0000000 --- a/lib/bin/sdm.js +++ /dev/null @@ -1,323 +0,0 @@ -#!/usr/bin/env node -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const framework_1 = require("../framework"); -const readline = __importStar(require("readline")); -const json_pipe_1 = require("@space48/json-pipe"); -const chalk_1 = __importDefault(require("chalk")); -const framework_2 = require("../framework"); -const docgen_1 = require("../framework/docgen"); -const __1 = require(".."); -const app = __1.sdm(); -var Flag; -(function (Flag) { - Flag["Force"] = "force"; -})(Flag || (Flag = {})); -const availableFlags = Object.values(Flag); -const argsExcludingFlags = process.argv.slice(2).filter(arg => !arg.startsWith("--")); -const flags = process.argv - .slice(2) - .filter(arg => arg.startsWith("--")) - .map(arg => arg.slice(2)); -const invalidFlags = flags.filter(flag => !availableFlags.includes(flag)); -if (invalidFlags.length > 0) { - const renderOptions = (options) => options.map(flag => `--${flag}`).join(", "); - process.stderr.write(`Invalid option${invalidFlags.length > 1 ? "s" : ""} ${renderOptions(invalidFlags)}. `); - process.stderr.write(`Valid options are ${renderOptions(availableFlags)}.\n`); - process.exit(1); -} -async function main() { - try { - if (argsExcludingFlags[0] === "help") { - await runHelpMode(); - process.exit(0); - } - if (!process.stdin.isTTY || - (argsExcludingFlags[0] && tryDecodeFQMessageHeader(argsExcludingFlags[0]))) { - await runNonInteractiveMode(); - process.exit(0); - } - await runInteractiveMode(); - process.exit(0); - } - catch (e) { - console.error(e); - process.exit(1); - } -} -async function runHelpMode() { - const connectorName = await resolveConnectorInteractively(argsExcludingFlags[1]); - const connector = app.connectors[connectorName]; - process.stderr.write(docgen_1.Shell.explainCliUsageOnCli(connector.$definition, { - connector: connectorName, - scope: connector.$definition.scopeNameExample, - })); -} -async function runNonInteractiveMode() { - const messageHeader = tryDecodeFQMessageHeader(argsExcludingFlags[0]); - if (messageHeader) { - await runNonInteractiveSingleMessageMode(messageHeader); - } - else { - const scopeRef = await resolveScope(argsExcludingFlags[0], false); - await runNonInteractiveMultiMessageMode(scopeRef); - } -} -async function runNonInteractiveMultiMessageMode(scopeRef) { - const scope = await app.requireScope(scopeRef); - await json_pipe_1.pipe(json_pipe_1.readJsonLinesFrom(process.stdin), commands => scope.execute(commands), json_pipe_1.writeJsonLinesTo(process.stdout)); -} -async function runNonInteractiveSingleMessageMode(header) { - const command = { - ...header, - input: argsExcludingFlags.length > 1 - ? framework_2.BinaryApi.decodeCommandInput(argsExcludingFlags[1]) - : undefined, - }; - await warnUserIfNecessary(header); - const scope = await app.requireScope(header.scope); - if (process.stdin.isTTY || command.input !== undefined) { - try { - await json_pipe_1.pipe(scope.execute(command), json_pipe_1.writeJsonLinesTo(process.stdout)); - } - catch (e) { - console.error(e instanceof framework_1.EndpointError ? JSON.stringify({ error: e.normalize() }, null, 2) : e); - process.exit(1); - } - } - else { - await json_pipe_1.pipe(json_pipe_1.readJsonLinesFrom(process.stdin), framework_1.State.map((input) => ({ ...command, input })), commands => scope.execute(commands), json_pipe_1.writeJsonLinesTo(process.stdout)); - } -} -async function runInteractiveMode() { - const scopeRef = await resolveScope(argsExcludingFlags[0], true); - for (;;) { - const command = await askForCommand(scopeRef); - let interrupted = false; - const sigintListener = () => { - interrupted = true; - }; - readlineInterface().once("SIGINT", sigintListener); - try { - await warnUserIfNecessary({ - scope: scopeRef, - path: command.path, - endpoint: command.endpoint, - }); - const scope = await app.requireScope(scopeRef); - let numOutputs = 0; - if (!interrupted) { - process.stderr.write("\n"); - const startTime = Date.now(); - await json_pipe_1.pipe(scope.execute(command), json_pipe_1.tap(() => { - numOutputs++; - return new Promise(setImmediate); - }), json_pipe_1.takeWhile(() => !interrupted), json_pipe_1.map(item => `${JSON.stringify(item)}\n\n`), // blank line to improve readability in interactive mode - json_pipe_1.writeTo(process.stdout)); - const runtimeSecs = (Date.now() - startTime) / 1000; - process.stderr.write(`${numOutputs} results in ${runtimeSecs}s\n\n`); - } - } - catch (e) { - console.error(e instanceof framework_1.EndpointError ? JSON.stringify({ error: e.normalize() }, null, 2) : e); - } - finally { - readlineInterface().removeListener("SIGINT", sigintListener); - } - } -} -async function askForCommand(scopeRef) { - const scope = await app.requireScope(scopeRef); - for (;;) { - process.stderr.write("Enter `help` to see a list of available commands.\n\n"); - const commandLine = await ask({ - question: `sdm ${framework_2.BinaryApi.encodeHeader({ scope: scopeRef })}> `, - completer: (line) => { - const additionalSuggestions = "help".startsWith(line) ? ["help"] : []; - const commandSuggestions = suggestCommands(scope.connector.$definition, line); - return [[...additionalSuggestions, ...commandSuggestions], line]; - }, - }); - if (commandLine === "help") { - process.stderr.write(docgen_1.Shell.explainInteractiveCliUsage(scope.connector.$definition)); - continue; - } - try { - return framework_2.BinaryApi.decodeCommand(commandLine); - } - catch (_a) { - continue; - } - } -} -function suggestCommands(connector, line) { - try { - const selectHost = framework_1.Path.selector(connector.resources); - const path = framework_2.BinaryApi.decodeIncompletePath(line); - const lastElement = path.slice(-1)[0]; - if (Array.isArray(lastElement)) { - // [full resource name, doc ID] - const host = selectHost(path); - return framework_1.Path.computeAllHeaders(host, path).map(framework_2.BinaryApi.encodeHeader); - } - else { - // partial resource name - const hostPath = path.slice(0, -1); - const host = hostPath.length === 0 ? connector : selectHost(hostPath); - return framework_1.Path.computeAllHeaders(host, hostPath) - .map(framework_2.BinaryApi.encodeHeader) - .filter(encodedPath => encodedPath.startsWith(line)); - } - } - catch (e) { - return []; - } -} -async function resolveConnectorInteractively(hint) { - const availableConnectors = Object.keys(app.connectors).map(framework_2.BinaryApi.encodeConnectorName); - const availableConnectorsStr = `Available connectors: ${availableConnectors.map(connector => `\n\t${connector}`)}\n`; - if (hint) { - if (availableConnectors.includes(hint)) { - return framework_2.BinaryApi.decodeConnectorName(hint); - } - process.stderr.write(`No such connector '${hint}'. ${availableConnectorsStr}`); - process.exit(1); - } - for (;;) { - const choice = await askForConnector(availableConnectors); - if (availableConnectors.includes(choice)) { - return framework_2.BinaryApi.decodeConnectorName(choice); - } - process.stderr.write(`No such connector '${choice}'. ${availableConnectorsStr}`); - } -} -async function askForConnector(options) { - const selection = await ask({ - question: ` -${title("Available connectors")} - -${options.join("\n")} - -Enter a connector: `, - completer: (line) => [options.filter(connector => connector.startsWith(line)), line], - }); - return selection; -} -async function resolveScope(hint, interactive) { - const availableScopes = await getAvailableScopes(); - const availableScopesStr = `Available scopes: ${availableScopes.map(scope => `\n\t${scope}`)}\n`; - if (hint) { - if (availableScopes.includes(hint)) { - return framework_2.BinaryApi.decodeScope(hint); - } - process.stderr.write(`Invalid scope '${hint}'. Use sdm-config to add new scopes. ${availableScopesStr}`); - process.exit(1); - } - if (!interactive) { - process.stderr.write(`Scope must be specified. ${availableScopesStr}`); - process.exit(1); - } - for (;;) { - const scopeStr = await askForScope(); - if (availableScopes.includes(scopeStr)) { - return framework_2.BinaryApi.decodeScope(scopeStr); - } - process.stderr.write(`Invalid scope '${scopeStr}'. Use sdm-config to add new scopes. ${availableScopesStr}`); - } -} -async function askForScope() { - const availableScopes = await getAvailableScopes(); - const selection = await ask({ - question: ` -${title("Available scopes")} - -${availableScopes.join("\n")} - -Enter a scope: `, - completer: (line) => [availableScopes.filter(scope => scope.startsWith(line)), line], - }); - return selection; -} -async function getAvailableScopes() { - return (await app.listScopes()).map(scope => framework_2.BinaryApi.encodeHeader({ scope })); -} -const safeEndpoints = ["get", "list"]; -async function warnUserIfNecessary(header) { - if (flags.includes(Flag.Force) || safeEndpoints.includes(header.endpoint)) { - return; - } - const scope = await app.requireScope(header.scope); - const warning = await scope.getWarningMessage(); - if (!warning) { - return; - } - const commandHeader = framework_2.BinaryApi.encodeHeader(header); - process.stderr.write(chalk_1.default.redBright.bold(`\nWARNING: ${warning} [${commandHeader}]\n\n`)); - const delaySecs = 15; - const interactiveMode = process.stdin.isTTY; - process.stderr.write(chalk_1.default.yellow(interactiveMode - ? `Press enter or wait ${delaySecs}s to proceed with \`${commandHeader}\`. Press ctrl+c to abort.\n\n` - : `sdm will proceed with \`${commandHeader}\` in ${delaySecs}s. Press ctrl+c to abort.\n\n`)); - const timeout = new Promise(resolve => setTimeout(resolve, delaySecs * 1000)); - await Promise.race([ - timeout, - new Promise(resolve => { - if (process.stdin.isTTY) { - process.stdin.once("data", resolve); - timeout.finally(() => process.stdin.removeListener("data", resolve)); - } - }), - ]); -} -let rl = undefined; -let rlCompleter = undefined; -function readlineInterface() { - if (!rl) { - rl = readline.createInterface({ - input: process.stdin, - output: process.stderr, - completer: (line) => rlCompleter === null || rlCompleter === void 0 ? void 0 : rlCompleter(line), - }); - } - return rl; -} -async function ask(options) { - rlCompleter = options === null || options === void 0 ? void 0 : options.completer; - const result = await new Promise(resolve => readlineInterface().question(options.question, resolve)); - rlCompleter = undefined; - return result; -} -function title(value) { - return chalk_1.default.underline.bold(value); -} -function tryDecodeFQMessageHeader(text) { - try { - return framework_2.BinaryApi.decodeFQHeader(text); - } - catch (_a) { - return undefined; - } -} -main(); diff --git a/lib/connectors/big-commerce/client.d.ts b/lib/connectors/big-commerce/client.d.ts deleted file mode 100644 index 4062874..0000000 --- a/lib/connectors/big-commerce/client.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as t from "io-ts"; -import { MutableReference } from "../../framework"; -export declare type Config = t.TypeOf; -export declare const configSchema: t.TypeC<{ - storeAlias: t.StringC; - storeHash: t.StringC; - credentials: t.TypeC<{ - clientId: t.StringC; - accessToken: t.StringC; - }>; -}>; -export default class BigCommerce { - private readonly config; - constructor(config: MutableReference); - private readonly readAgent; - private readonly writeAgent; - get(uri: string, params?: Record): Promise; - list(uri: string, params?: Record): AsyncIterable; - post(uri: string, content: any): Promise; - put(uri: string, content: any): Promise; - patch(uri: string, content: any): Promise; - delete(uri: string, params?: Record): Promise; - private doGet; - private makeRequestWithContent; - private fetch; - private init; -} diff --git a/lib/connectors/big-commerce/client.js b/lib/connectors/big-commerce/client.js deleted file mode 100644 index 4207cdd..0000000 --- a/lib/connectors/big-commerce/client.js +++ /dev/null @@ -1,164 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.configSchema = void 0; -const node_fetch_1 = __importDefault(require("node-fetch")); -const query_string_1 = require("query-string"); -const p_retry_1 = __importDefault(require("p-retry")); -const t = __importStar(require("io-ts")); -const framework_1 = require("../../framework"); -const https_1 = require("https"); -const ramda_1 = __importDefault(require("ramda")); -const listConcurrency = 50; -exports.configSchema = t.type({ - storeAlias: t.string, - storeHash: t.string, - credentials: t.type({ - clientId: t.string, - accessToken: t.string, - }), -}); -class BigCommerce { - constructor(config) { - this.config = config; - this.readAgent = new https_1.Agent({ - keepAlive: true, - maxSockets: 100, - }); - this.writeAgent = new https_1.Agent({ - keepAlive: true, - maxSockets: 10, - }); - } - async get(uri, params) { - return unwrap(await this.doGet(uri, params)); - } - async *list(uri, params) { - var _a; - // a lot of list reqs involve a single page or don't support pagination, only do one req in those cases - const firstPage = await this.doGet(uri, { page: 1, ...(params || {}) }); - if (!firstPage) { - return; - } - yield* unwrap(firstPage); - const totalPages = uri.startsWith("v3") - ? ((_a = firstPage.meta) === null || _a === void 0 ? void 0 : _a.pagination) ? computeNumPages(firstPage.meta.pagination) - : 1 - : Number.MAX_SAFE_INTEGER; - const concurrency = Math.min(totalPages, listConcurrency); - const threads = [...new Array(concurrency).keys()]; - for (let page = 2; page <= totalPages; page += concurrency) { - const pages = await Promise.all(threads.map(threadId => this.get(uri, { page: page + threadId, ...(params || {}) }))); - const nonNullPages = pages.filter(Boolean); - yield* ramda_1.default.flatten(nonNullPages); - const lastPage = pages.slice(-1)[0]; - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) { - break; - } - } - } - async post(uri, content) { - return this.makeRequestWithContent("POST", uri, content); - } - async put(uri, content) { - return this.makeRequestWithContent("PUT", uri, content); - } - async patch(uri, content) { - return this.makeRequestWithContent("PATCH", uri, content); - } - async delete(uri, params) { - const paramsString = params ? `?${query_string_1.stringify(params, { arrayFormat: "comma" })}` : ""; - return unwrap(await this.fetch(this.writeAgent, uri + paramsString, { - ...params, - method: "DELETE", - })); - } - async doGet(uri, params) { - const paramsString = params ? `?${query_string_1.stringify(params, { arrayFormat: "comma" })}` : ""; - return await this.fetch(this.readAgent, uri + paramsString); - } - async makeRequestWithContent(method, uri, content) { - return unwrap(await this.fetch(this.writeAgent, uri, { - method, - headers: content && { - "Content-Type": "application/json", - }, - body: content && JSON.stringify(content), - })); - } - async fetch(agent, relativeUri, init) { - const config = this.config.get(); - const absoluteUri = `https://api.bigcommerce.com/stores/${config.storeHash}/${relativeUri}`; - const initResolved = this.init(agent, config, init); - // response body may only be consumed once, so we have to memoize the result here - let responseText; - const response = await p_retry_1.default(async () => { - const response = await node_fetch_1.default(absoluteUri, initResolved); - responseText = response.text(); - if (response.status === 422) { - if ((await responseText).includes("saving error")) { - throw new Error(); // this will trigger a retry - } - } - if (response.status === 429 || (response.status >= 500 && response.status < 600)) { - throw new Error(); // this will trigger a retry - } - return response; - }, { retries: 50, minTimeout: 2500 }); - if (!response.ok) { - throw new framework_1.EndpointError(`${response.status} ${response.statusText}`, { - detail: await responseText - .then(JSON.parse) - .then(data => (data.errors && JSON.stringify(data.errors) !== "{}" ? data.errors : data.title) || - data) - .catch(), - }); - } - if (response.status === 204) { - return null; - } - return await responseText.then(JSON.parse); - } - init(agent, config, init) { - const headers = { - ...init === null || init === void 0 ? void 0 : init.headers, - Accept: "application/json", - "X-Auth-Token": config.credentials.accessToken, - "X-Auth-Client": config.credentials.clientId, - }; - return { - ...init, - headers, - agent, - }; - } -} -exports.default = BigCommerce; -function unwrap(content) { - return (content === null || content === void 0 ? void 0 : content.data) === undefined ? content : content.data; -} -function computeNumPages(pagination) { - // note -- total_pages does not respect the actual page size, so we cannot use it - return pagination.total === 0 ? 0 : Math.ceil(pagination.total / pagination.count); -} diff --git a/lib/connectors/big-commerce/functions.d.ts b/lib/connectors/big-commerce/functions.d.ts deleted file mode 100644 index 68bffba..0000000 --- a/lib/connectors/big-commerce/functions.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -import BigCommerce from "./client"; -import { DocId, EndpointDefinition, Path } from "../../framework"; -export interface Query { - [key: string]: any; -} -export declare class endpoint { - private constructor(); - static crud(uriPattern: string, idField?: string): { - endpoints: { - create: EndpointDefinition; - list: EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: Path) => AsyncIterable; - endpoints: { - delete: EndpointDefinition; - get: EndpointDefinition; - update: EndpointDefinition; - }; - }; - }; - static fn(uriPattern: string, _fn: (client: BigCommerce, uri: string, data: I, path: ReadonlyArray) => Promise | AsyncIterable): EndpointDefinition; - static create: (uriPattern: string) => EndpointDefinition; - static del: (uriPattern: string) => EndpointDefinition; - static get: (uriPattern: string) => EndpointDefinition; - static list: (uriPattern: string) => EndpointDefinition; - static update: (uriPattern: string) => EndpointDefinition; -} -export declare class batch { - private constructor(); - static crud(uriPattern: string, idField?: string): { - endpoints: { - create: EndpointDefinition; - delete: EndpointDefinition; - list: EndpointDefinition; - update: EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: Path) => AsyncIterable; - endpoints: { - delete: EndpointDefinition; - get: EndpointDefinition; - }; - }; - }; - static createOneOrMany: (uriPattern: string) => EndpointDefinition; - static deleteOne: (uriPattern: string) => EndpointDefinition; - static deleteMany: (uriPattern: string) => EndpointDefinition; - static getOne: (uriPattern: string) => EndpointDefinition; - static updateMany: (uriPattern: string) => EndpointDefinition; -} -export declare class UriTemplate { - static uri(uriTemplate: string, fieldValues: ReadonlyArray): string; - static applyValues(uriTemplate: string, fieldValues: ReadonlyArray): string; - static fields(uriTemplate: string): string[]; -} -export declare function listIds(uriPattern: string, idField?: string): (client: BigCommerce) => (path: Path) => AsyncIterable; diff --git a/lib/connectors/big-commerce/functions.js b/lib/connectors/big-commerce/functions.js deleted file mode 100644 index 70e9382..0000000 --- a/lib/connectors/big-commerce/functions.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.listIds = exports.UriTemplate = exports.batch = exports.endpoint = void 0; -const framework_1 = require("../../framework"); -const json_pipe_1 = require("@space48/json-pipe"); -class endpoint { - constructor() { - return; - } - static crud(uriPattern, idField = "id") { - const docUriPattern = `${uriPattern}/{id}`; - return framework_1.resource({ - endpoints: { - create: endpoint.create(uriPattern), - list: endpoint.list(uriPattern), - }, - documents: { - idField, - listIds: listIds(uriPattern, idField), - endpoints: { - delete: endpoint.del(docUriPattern), - get: endpoint.get(docUriPattern), - update: endpoint.update(docUriPattern), - }, - }, - }); - } - static fn(uriPattern, _fn) { - return client => ({ path, input }) => { - const uri = UriTemplate.uri(uriPattern, framework_1.Path.getDocIds(path)); - return _fn(client, uri, input, framework_1.Path.getDocIds(path)); - }; - } -} -exports.endpoint = endpoint; -endpoint.create = (uriPattern) => endpoint.fn(uriPattern, (bcClient, uri, data) => bcClient.post(uri, data)); -endpoint.del = (uriPattern) => endpoint.fn(uriPattern, (bcClient, uri, data) => bcClient.delete(uri, data)); -endpoint.get = (uriPattern) => endpoint.fn(uriPattern, (bcClient, uri, data) => bcClient.get(uri, data)); -endpoint.list = (uriPattern) => endpoint.fn(uriPattern, (bcClient, uri, query) => bcClient.list(uri, query)); -endpoint.update = (uriPattern) => endpoint.fn(uriPattern, (bcClient, uri, data) => bcClient.put(uri, data)); -// Following functions are for compatibility with batch endpoints -class batch { - constructor() { - return; - } - static crud(uriPattern, idField = "id") { - return { - endpoints: { - create: batch.createOneOrMany(uriPattern), - delete: batch.deleteMany(uriPattern), - list: endpoint.list(uriPattern), - update: batch.updateMany(uriPattern), - }, - documents: { - idField, - listIds: listIds(uriPattern, idField), - endpoints: { - delete: batch.deleteOne(uriPattern), - get: batch.getOne(uriPattern), - }, - }, - }; - } -} -exports.batch = batch; -batch.createOneOrMany = (uriPattern) => endpoint.fn(uriPattern, (bcClient, uri, data) => bcClient.post(uri, Array.isArray(data) ? data : [data])); -batch.deleteOne = (uriPattern) => endpoint.fn(uriPattern, async (bcClient, uri, data, path) => { - await bcClient.delete(uri, { ...data, "id:in": path[path.length - 1] }); -}); -batch.deleteMany = (uriPattern) => endpoint.fn(uriPattern, (bcClient, uri, data) => bcClient.delete(uri, data)); -batch.getOne = (uriPattern) => endpoint.fn(uriPattern, async (bcClient, uri, data, path) => { - const result = await bcClient.get(uri, { ...data, "id:in": path[path.length - 1] }); - return result[0]; -}); -batch.updateMany = (uriPattern) => endpoint.fn(uriPattern, (bcClient, uri, data) => bcClient.put(uri, data)); -class UriTemplate { - static uri(uriTemplate, fieldValues) { - const uri = UriTemplate.applyValues(uriTemplate, fieldValues); - const missingValues = UriTemplate.fields(uri); - if (UriTemplate.fields(uri).length > 0) { - throw new Error(`Missing URI fields ${missingValues.join(", ")}`); - } - return uri; - } - static applyValues(uriTemplate, fieldValues) { - return UriTemplate.fields(uriTemplate) - .filter((field, index) => { var _a; return ((_a = fieldValues[index]) !== null && _a !== void 0 ? _a : null) !== null; }) - .reduce((uri, field, index) => uri.replace(`{${field}}`, String(fieldValues[index])), uriTemplate); - } - static fields(uriTemplate) { - var _a; - // todo: convert to matchAll once we support ES2020 - return (((_a = uriTemplate.match(/\{[^}]+\}/g)) === null || _a === void 0 ? void 0 : _a.map(match => match.substring(1, match.length - 1))) || []); - } -} -exports.UriTemplate = UriTemplate; -function listIds(uriPattern, idField = "id") { - return (client) => (path) => { - const uri = UriTemplate.uri(uriPattern, framework_1.Path.getDocIds(path)); - const docs = client.list(uri, { include_fields: [] }); - return json_pipe_1.pipe(docs, json_pipe_1.map(doc => doc[idField])); - }; -} -exports.listIds = listIds; diff --git a/lib/connectors/big-commerce/index.d.ts b/lib/connectors/big-commerce/index.d.ts deleted file mode 100644 index 288ae92..0000000 --- a/lib/connectors/big-commerce/index.d.ts +++ /dev/null @@ -1,731 +0,0 @@ -import BigCommerce, { Config } from "./client"; -import { Query } from "./functions"; -import * as f from "../../framework"; -export declare type BigCommerceConfig = Config; -export declare const bigCommerce: f.Connector<{ - storeAlias: string; - storeHash: string; - credentials: { - clientId: string; - accessToken: string; - }; -}, BigCommerce, { - blog: { - resources: { - posts: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - tags: { - endpoints: { - list: f.EndpointDefinition; - }; - }; - }; - }; - brands: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - image: { - endpoints: { - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - }; - }; - metafields: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }; - }>; - carts: { - endpoints: { - create: f.EndpointDefinition; - }; - documents: { - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - resources: { - items: { - endpoints: { - create: f.EndpointDefinition; - }; - documents: { - endpoints: { - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }; - }; - }; - categories: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap & { - tree: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - }, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - image: { - endpoints: { - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - }; - }; - metafields: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }; - }>; - channels: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - customers: f.ResourceDefinition; - delete: f.EndpointDefinition; - list: f.EndpointDefinition; - update: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap & { - addresses: { - endpoints: { - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - list: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - }; - }; - }; - attributes: f.ResourceDefinition; - delete: f.EndpointDefinition; - list: f.EndpointDefinition; - update: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap & { - values: { - endpoints: { - delete: f.EndpointDefinition; - list: f.EndpointDefinition; - upsert: f.EndpointDefinition; - }; - documents: { - endpoints: { - delete: f.EndpointDefinition; - }; - }; - }; - }, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - }; - } & { - resources: { - values: { - endpoints: { - list: f.EndpointDefinition; - }; - }; - }; - }>; - formFieldValues: { - endpoints: { - list: f.EndpointDefinition; - upsert: f.EndpointDefinition; - }; - }; - customerGroups: { - endpoints: { - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }; - }; - subscribers: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - }; - } & f.DocumentDefinition>; - giftCertificates: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - orders: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap & { - statuses: { - endpoints: { - list: f.EndpointDefinition; - }; - documents: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - }; - }, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - refunds: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - shippingAddresses: { - documents: { - endpoints: { - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - endpoints: { - list: f.EndpointDefinition; - }; - }; - products: { - endpoints: { - list: f.EndpointDefinition; - }; - documents: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - }; - coupons: { - endpoints: { - list: f.EndpointDefinition; - }; - }; - shipments: { - endpoints: { - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - }; - documents: { - endpoints: { - get: f.EndpointDefinition; - update: f.EndpointDefinition; - delete: f.EndpointDefinition; - }; - }; - }; - metafields: { - endpoints: { - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }; - documents: { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }; - }>; - pages: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - paymentMethods: { - endpoints: { - list: f.EndpointDefinition; - }; - }; - priceLists: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap & { - assignments: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - delete: f.EndpointDefinition; - }; - }; - }, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - records: { - endpoints: { - list: f.EndpointDefinition; - upsert: f.EndpointDefinition; - delete: f.EndpointDefinition; - }; - }; - }; - }>; - products: f.ResourceDefinition; - list: f.EndpointDefinition; - } & { - update: f.EndpointDefinition; - }, f.ResourceDefinitionMap & { - variants: { - endpoints: { - list: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - channelAssignments: { - endpoints: { - list: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - bulkPricingRules: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - complexRules: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - customFields: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - images: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - metafields: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - modifiers: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - values: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - image: { - endpoints: { - create: f.EndpointDefinition; - }; - documents: { - endpoints: { - delete: f.EndpointDefinition; - }; - }; - }; - }; - }>; - }; - }>; - options: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - values: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }; - }>; - reviews: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - variants: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - metafields: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }; - }>; - videos: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }; - }>; - promotions: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - codes: { - endpoints: { - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - endpoints: { - delete: f.EndpointDefinition; - }; - }; - }; - }; - }>; - store: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - widgets: { - endpoints: { - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }; - documents: { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - resources: { - regions: { - endpoints: { - list: f.EndpointDefinition; - }; - }; - templates: { - endpoints: { - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }; - documents: { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - placements: { - endpoints: { - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }; - documents: { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - }; - }; - wishlists: f.ResourceDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: BigCommerce) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - items: { - endpoints: { - create: f.EndpointDefinition; - }; - documents: { - endpoints: { - delete: f.EndpointDefinition; - }; - }; - }; - }; - }>; -}>; diff --git a/lib/connectors/big-commerce/index.js b/lib/connectors/big-commerce/index.js deleted file mode 100644 index df05932..0000000 --- a/lib/connectors/big-commerce/index.js +++ /dev/null @@ -1,433 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.bigCommerce = void 0; -const client_1 = __importStar(require("./client")); -const framework_1 = require("../../framework"); -const functions_1 = require("./functions"); -const mergeResources = framework_1.resourceMerger(); -exports.bigCommerce = framework_1.connector({ - configSchema: client_1.configSchema, - scopeNameExample: "some-store-alias", - getScopeName: config => config.storeAlias, - getScope: config => new client_1.default(config), - getWarningMessage: async (client) => { - try { - const store = await client.get("v2/store"); - if (store.status === "live") { - return `Store is LIVE at ${store.domain}`; - } - if (!store.domain.endsWith(".mybigcommerce.com")) { - return `Store is using custom domain ${store.domain}`; - } - } - catch (_a) { - return "Failed to fetch store data from BigCommerce API. This could be a live store."; - } - }, - resources: { - blog: { - resources: { - posts: functions_1.endpoint.crud("v2/blog/posts"), - tags: { - endpoints: { - list: functions_1.endpoint.list("v2/blog/tags"), - }, - }, - }, - }, - brands: mergeResources(functions_1.endpoint.crud("v3/catalog/brands"), { - documents: { - resources: { - image: { - endpoints: { - create: functions_1.endpoint.create("v3/catalog/brands/{id}/image"), - delete: functions_1.endpoint.del("v3/catalog/brands/{id}/image"), - }, - }, - metafields: functions_1.endpoint.crud("v3/catalog/brands/{id}/metafields"), - }, - }, - }), - carts: { - endpoints: { - create: functions_1.endpoint.create("v3/carts"), - }, - documents: { - endpoints: { - delete: functions_1.endpoint.del("v3/carts/{id}"), - get: functions_1.endpoint.get("v3/carts/{id}"), - update: functions_1.endpoint.update("v3/carts/{id}"), - }, - resources: { - items: { - endpoints: { - create: functions_1.endpoint.create("v3/carts/{id}/items"), - }, - documents: { - endpoints: { - delete: functions_1.endpoint.del("v3/carts/{id}/items/{id}"), - update: functions_1.endpoint.update("v3/carts/{id}/items/{id}"), - }, - }, - }, - }, - }, - }, - categories: mergeResources(functions_1.endpoint.crud("v3/catalog/categories"), { - resources: { - tree: { - endpoints: { - get: functions_1.endpoint.get("v3/catalog/categories/tree"), - }, - }, - }, - documents: { - resources: { - image: { - endpoints: { - create: functions_1.endpoint.create("v3/catalog/categories/{id}/image"), - delete: functions_1.endpoint.del("v3/catalog/categories/{id}/image"), - }, - }, - metafields: functions_1.endpoint.crud("v3/catalog/categories/{id}/metafields"), - }, - }, - }), - channels: { - endpoints: { - create: functions_1.endpoint.create("v3/channel"), - list: functions_1.endpoint.list("v3/channel"), - }, - documents: { - listIds: functions_1.listIds("v3/channel"), - endpoints: { - get: functions_1.endpoint.get("v3/channel/{id}"), - update: functions_1.endpoint.update("v3/channel/{id}"), - }, - }, - }, - customers: mergeResources(functions_1.batch.crud("v3/customers"), { - resources: { - addresses: functions_1.batch.crud("v3/customers/addresses"), - attributes: mergeResources(functions_1.batch.crud("v3/customers/attributes"), { - documents: { - resources: { - values: { - endpoints: { - list: functions_1.endpoint.fn("v3/customers/attribute-values", (bcClient, uri, query, [attributeId]) => bcClient.list(uri, { - ...query, - "attribute_id:in": attributeId, - })), - }, - }, - }, - }, - resources: { - values: { - endpoints: { - delete: functions_1.batch.deleteMany("v3/customers/attribute-values"), - list: functions_1.endpoint.list("v3/customers/attribute-values"), - upsert: functions_1.batch.updateMany("v3/customers/attribute-values"), - }, - documents: { - endpoints: { - delete: functions_1.batch.deleteOne("v3/customers/attribute-values"), - }, - }, - }, - }, - }), - formFieldValues: { - endpoints: { - list: functions_1.endpoint.list("v3/customers/form-field-values"), - upsert: functions_1.batch.updateMany("v3/customers/form-field-values"), - }, - }, - customerGroups: { - endpoints: { - list: functions_1.endpoint.list("v2/customer_groups"), - create: functions_1.endpoint.create("v2/customer_groups"), - }, - }, - subscribers: functions_1.endpoint.crud("v3/customers/subscribers"), - }, - }), - giftCertificates: functions_1.endpoint.crud("v2/gift_certificates"), - orders: mergeResources(functions_1.endpoint.crud("v2/orders"), { - documents: { - resources: { - refunds: { - endpoints: { - get: functions_1.endpoint.get("v3/orders/{id}/payment_actions/refunds"), - }, - }, - shippingAddresses: { - documents: { - endpoints: { - get: functions_1.endpoint.get("v2/orders/{id}/shipping_addresses/{shipping_address_id}"), - update: functions_1.endpoint.update("v2/orders/{id}/shipping_addresses/{shipping_address_id}"), - }, - }, - endpoints: { - list: functions_1.endpoint.list("v2/orders/{id}/shipping_addresses"), - }, - }, - products: { - endpoints: { - list: functions_1.endpoint.list("v2/orders/{id}/products"), - }, - documents: { - endpoints: { - get: functions_1.endpoint.get("v2/orders/{id}/products/{product_id}"), - }, - }, - }, - coupons: { - endpoints: { - list: functions_1.endpoint.list("v2/orders/{id}/coupons"), - }, - }, - shipments: { - endpoints: { - list: functions_1.endpoint.list("v2/orders/{id}/shipments"), - create: functions_1.endpoint.create("v2/orders/{id}/shipments"), - delete: functions_1.endpoint.del("v2/orders/{id}/shipments"), - }, - documents: { - endpoints: { - get: functions_1.endpoint.get("v2/orders/{id}/shipments/{shipment_id}"), - update: functions_1.endpoint.update("v2/orders/{id}/shipments/{shipment_id}"), - delete: functions_1.endpoint.del("v2/orders/{id}/shipments/{shipment_id}"), - }, - }, - }, - metafields: { - endpoints: { - list: functions_1.endpoint.list("v3/orders/{id}/metafields"), - create: functions_1.endpoint.create("v3/orders/{id}/metafields"), - }, - documents: { - endpoints: { - get: functions_1.endpoint.get("v3/orders/{id}/metafields/{id}"), - delete: functions_1.endpoint.del("v3/orders/{id}/metafields/{id}"), - update: functions_1.endpoint.update("v3/orders/{id}/metafields/{id}"), - }, - }, - }, - }, - }, - resources: { - statuses: { - endpoints: { - list: functions_1.endpoint.fn("v2/order_statuses", async function* (bcClient, uri) { - yield* await bcClient.get(uri); - }), - }, - documents: { - endpoints: { - get: functions_1.endpoint.get("v2/order_statuses/{id}"), - }, - }, - }, - }, - }), - pages: functions_1.endpoint.crud("v2/pages"), - paymentMethods: { - endpoints: { - list: functions_1.endpoint.list("v3/payments/methods"), - }, - }, - priceLists: mergeResources(functions_1.endpoint.crud("v3/pricelists"), { - resources: { - assignments: { - endpoints: { - create: functions_1.endpoint.create("v3/pricelists/assignments"), - list: functions_1.endpoint.list("v3/pricelists/assignments"), - delete: functions_1.endpoint.del("v3/pricelists/assignments"), - }, - }, - }, - documents: { - resources: { - records: { - endpoints: { - list: functions_1.endpoint.list("v3/pricelists/{id}/records"), - upsert: functions_1.endpoint.update("v3/pricelists/{id}/records"), - delete: functions_1.endpoint.del("v3/pricelists/{id}/records"), - }, - }, - }, - }, - }), - products: mergeResources(functions_1.endpoint.crud("v3/catalog/products"), { - endpoints: { - update: functions_1.batch.updateMany("v3/catalog/products"), - }, - resources: { - variants: { - endpoints: { - list: functions_1.endpoint.list("v3/catalog/variants"), - update: functions_1.batch.updateMany("v3/catalog/variants"), - }, - }, - channelAssignments: { - endpoints: { - list: functions_1.endpoint.list("v3/catalog/products/channel-assignments"), - update: functions_1.batch.updateMany("v3/catalog/products/channel-assignments") - } - } - }, - documents: { - resources: { - bulkPricingRules: functions_1.endpoint.crud("v3/catalog/products/{id}/bulk-pricing-rules"), - complexRules: functions_1.endpoint.crud("v3/catalog/products/{id}/complex-rules"), - customFields: functions_1.endpoint.crud("v3/catalog/products/{id}/custom-fields"), - images: functions_1.endpoint.crud("v3/catalog/products/{id}/images"), - metafields: functions_1.endpoint.crud("v3/catalog/products/{id}/metafields"), - modifiers: mergeResources(functions_1.endpoint.crud("v3/catalog/products/{id}/modifiers"), { - documents: { - resources: { - values: mergeResources(functions_1.endpoint.crud("v3/catalog/products/{id}/modifiers/{id}/values"), { - documents: { - resources: { - image: { - endpoints: { - create: functions_1.endpoint.create("v3/catalog/products/{id}/modifiers/{id}/values/{id}/image"), - }, - documents: { - endpoints: { - delete: functions_1.endpoint.del("v3/catalog/products/{id}/modifiers/{id}/values/{id}/image/{id}"), - }, - }, - }, - }, - }, - }), - }, - }, - }), - options: mergeResources(functions_1.endpoint.crud("v3/catalog/products/{id}/options"), { - documents: { - resources: { - values: functions_1.endpoint.crud("v3/catalog/products/{id}/options/{id}/values"), - }, - }, - }), - reviews: functions_1.endpoint.crud("v3/catalog/products/{id}/reviews"), - variants: mergeResources(functions_1.endpoint.crud("v3/catalog/products/{id}/variants"), { - documents: { - resources: { - metafields: functions_1.endpoint.crud("v3/catalog/products/{id}/variants/{id}/metafields"), - }, - }, - }), - videos: functions_1.endpoint.crud("v3/catalog/products/{id}/videos"), - }, - }, - }), - promotions: mergeResources(functions_1.endpoint.crud("v3/promotions"), { - documents: { - resources: { - codes: { - endpoints: { - create: functions_1.endpoint.create("v3/promotions/{id}/codes"), - delete: functions_1.batch.deleteMany("v3/promotions/{id}/codes"), - list: functions_1.endpoint.list("v3/promotions/{id}/codes"), - }, - documents: { - endpoints: { - delete: functions_1.endpoint.del("v3/promotions/{id}/codes/{code_id}"), - }, - }, - }, - }, - }, - }), - store: { - endpoints: { - get: functions_1.endpoint.get("v2/store"), - }, - }, - widgets: { - endpoints: { - list: functions_1.endpoint.list("v3/content/widgets"), - create: functions_1.endpoint.create("v3/content/widgets"), - }, - documents: { - endpoints: { - get: functions_1.endpoint.get("v3/content/widgets/{id}"), - delete: functions_1.endpoint.del("v3/content/widgets/{id}"), - update: functions_1.endpoint.update("v3/content/widgets/{id}"), - }, - }, - resources: { - regions: { - endpoints: { - list: functions_1.endpoint.list("v3/content/regions"), - }, - }, - templates: { - endpoints: { - list: functions_1.endpoint.list("v3/content/widget-templates"), - create: functions_1.endpoint.create("v3/content/widget-templates"), - }, - documents: { - endpoints: { - get: functions_1.endpoint.get("v3/content/widget-templates/{id}"), - delete: functions_1.endpoint.del("v3/content/widget-templates/{id}"), - update: functions_1.endpoint.update("v3/content/widget-templates/{id}"), - }, - }, - }, - placements: { - endpoints: { - list: functions_1.endpoint.list("v3/content/placements"), - create: functions_1.endpoint.create("v3/content/placements"), - }, - documents: { - endpoints: { - get: functions_1.endpoint.get("v3/content/placements/{id}"), - delete: functions_1.endpoint.del("v3/content/placements/{id}"), - update: functions_1.endpoint.update("v3/content/placements/{id}"), - }, - }, - }, - }, - }, - wishlists: mergeResources(functions_1.endpoint.crud("v3/wishlists"), { - documents: { - resources: { - items: { - endpoints: { - create: functions_1.endpoint.create("v3/wishlists/{id}/items"), - }, - documents: { - endpoints: { - delete: functions_1.endpoint.del("v3/wishlists/{id}/items/{id}"), - }, - }, - }, - }, - }, - }), - }, -}); diff --git a/lib/connectors/big-commerce/types/catalog.v3.d.ts b/lib/connectors/big-commerce/types/catalog.v3.d.ts deleted file mode 100644 index 5208f2e..0000000 --- a/lib/connectors/big-commerce/types/catalog.v3.d.ts +++ /dev/null @@ -1,10340 +0,0 @@ -/** - * This file was auto-generated by openapi-typescript. - * Do not make direct changes to the file. - */ -export interface paths { - "/catalog/products": { - /** Returns a list of **Products**. Optional filter parameters can be passed in. */ - get: operations["getProducts"]; - /** - * Updates products in batches. At the time of writing, batches are limited to 10 products. - * - * **Required Fields** - * * `id` - product `id` is required for batch updates to products. - * - * **Read-Only Fields** - * - `id` - * - `date_created` - * - `date_modified` - * - `calculated_price` - * - `base_variant_id` - */ - put: operations["updateProducts"]; - /** - * Creates a *Product*. Only one product can be created at a time. - * - * **Required Fields:** - * - `name` - * - `type` - * - `weight` - * - `price` - * - * **Read-Only Fields** - * - `id` - * - `date_created` - * - `date_modified` - * - `calculated_price` - * - `base_variant_id` - * - * **Usage Notes** - * * `POST` requests to `/products` accepts a single `video` object; to send an array of video objects, see: `/products/{product_id}/videos`. - */ - post: operations["createProduct"]; - /** - * To delete *Product* objects, you must include a filter. This prevents inadvertently deleting all *Product* objects in a store. - * - * **Example**: - * To delete products with the id's of 1,2 and 3, use `DELETE /v3/catalog/products?id:in=1,2,3`. - */ - delete: operations["deleteProducts"]; - }; - "/catalog/products/{product_id}": { - /** Returns a single *Product*. Optional parameters can be passed in. */ - get: operations["getProductById"]; - /** - * Updates a *Product*. - * - * **Read-Only Fields** - * - id - * - date_created - * - date_modified - * - calculated_price - * - base_variant_id - */ - put: operations["updateProduct"]; - /** Deletes a *Product*. */ - delete: operations["deleteProductById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/images": { - /** Returns a list of *Product Images*. Optional parameters can be passed in. */ - get: operations["getProductImages"]; - /** - * Creates a *Product Image*. - * - * **Required Fields** - * - `image_file`, or - * - `image_url` - * - * **Usage Notes** - * - `image_url` - `255` character limit - * - For file uploads, use the `multipart/form-data` media type - * - Only one image at a time can be created - * - Supported image file types are BMP, GIF, JPEG, PNG, WBMP, and XBM. - */ - post: operations["createProductImage"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/images/{image_id}": { - /** Returns a single *Product Image*. Optional parameters can be passed in. */ - get: operations["getProductImageById"]; - /** - * Updates a *Product Image*. - * - * **Usage Notes** - * - `image_url` - `255` character limit - * - For file uploads, send a POST request using the `multipart/form-data` media type - */ - put: operations["updateProductImage"]; - /** Deletes a *Product Image*. */ - delete: operations["deleteProductImage"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `Image` that is being operated on. */ - image_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/videos": { - /** Returns a list of *Product Videos*. Optional parameters can be passed in. */ - get: operations["getProductVideos"]; - /** - * Creates a *Product Video*. - * - * **Required Fields** - * * video_id - Example: https://www.youtube.com/watch?v=`R12345677` - * - * **Read-Only Fields** - * * id - * - * Publicly accessible URLs are valid parameters. - * Videos must be loaded through YouTube at this time. - */ - post: operations["createProductVideo"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/videos/{id}": { - /** Returns a single *Product Video*. Optional parameters can be passed in. */ - get: operations["getProductVideoById"]; - /** - * Updates a *Product Video. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - */ - put: operations["updateProductVideo"]; - /** Deletes a *Product Video*. */ - delete: operations["deleteProductVideo"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The BigCommerce ID of the `Video` */ - id: parameters["VideoIdParam"]; - }; - }; - }; - "/catalog/products/{product_id}/variants": { - /** Returns a list of product *Variants*. Optional parameters can be passed in. */ - get: operations["getVariantsByProductId"]; - /** - * Creates a *Product Variant*. - * - * **Required Fields** - * * sku - * * option_values - * - * **Read-Only Fields** - * * id - * - * Variants need to be created one at a time using this endpoint. To use a variant array and create products and variants in the same call use the [Create Products](/api-reference/catalog/catalog-api/products/createproduct) during the initial product creation. - */ - post: operations["createVariant"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/variants/{variant_id}": { - /** Returns a single product *Variant*. Optional parameters can be passed in. */ - get: operations["getVariantById"]; - /** Updates a product *Variant*. */ - put: operations["updateVariant"]; - /** Deletes a product *Variant*. */ - delete: operations["deleteVariantById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** ID of the variant on a product, or on an associated Price List Record. */ - variant_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/variants/{variant_id}/metafields": { - /** Returns a list of product variant *Metafields*. Optional parameters can be passed in. */ - get: operations["getVariantMetafieldsByProductIdAndVariantId"]; - /** - * Creates a product variant *Metafield*. - * - * **Required Fields:** - * * permission_set - * * namespace - * * key - * * value - * - * **Read-Only Fields** - * * id - * - * **Note:** The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - post: operations["createVariantMetafield"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** ID of the variant on a product, or on an associated Price List Record. */ - variant_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/variants/{variant_id}/metafields/{metafield_id}": { - /** Returns a single product variant *Metafield*. Optional parameters can be passed in. */ - get: operations["getVariantMetafieldByProductIdAndVariantId"]; - /** - * Updates a product variant *Metafield*. - * - * **Required Fields:** - * * none - * - * **Read-Only Fields** - * * id - * * These fields can only be modified by the app (API credentials) that created the metafield: - * * namespace - * * key - * * permission_set - * - * **Usage Notes** - * * Attempting to modify `namespace`, `key`, and `permission_set` fields using a client ID different from the one used to create those metafields will result in a 403 error message. - */ - put: operations["updateVariantMetafield"]; - /** Deletes a product variant *Metafield*. */ - delete: operations["deleteVariantMetafieldById"]; - parameters: { - path: { - /** The ID of the `Metafield`. */ - metafield_id: unknown; - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** ID of the variant on a product, or on an associated Price List Record. */ - variant_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/variants/{variant_id}/image": { - /** - * Creates a *Variant Image*. - * - * The image will show on the storefront when the value is selected. - * - * **Required Fields** - * - image_file: Form posts. Files larger than 1 MB are not accepted - * - image_url: Any publicly available URL - */ - post: operations["createVariantImage"]; - }; - "/catalog/products/{product_id}/options": { - /** Returns a list of product *Variant Options*. Optional parameters can be passed in. */ - get: operations["getOptions"]; - /** - * Creates a *Variant Option*. - * - * **Required Fields** - * * display_name - * * type - * * option_values - * - * **Read-Only Fields** - * * id - * - * **Notes** - * - * * Only one variant option at a time can be created; individual variant options will contain an array of multiple values. - * * There are several examples listed below that create options, but the SKU’s are not updated and they are not a variant on the product. Variant SKUs must be created with a separate request. - * * Variant options will show on the storefront as an option that can be selected by the customer. A request like this could be used to add new choices to a variant that has already been created. - * * If more than one variant needs to be created use the [Create a Product](/api-reference/catalog/catalog-api/products/createproduct) endpoint. - */ - post: operations["createOption"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/options/{option_id}": { - /** Returns a single *Variant Option*. Optional parameters can be passed in. */ - get: operations["getOptionById"]; - /** - * Updates a *Variant Option*. - * - * **Read-Only Fields** - * * id - */ - put: operations["updateOption"]; - /** Deletes a *Variant Option*. */ - delete: operations["deleteOptionById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `Option`. */ - option_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/options/{option_id}/values": { - /** Returns a list of all *Variant Option Values*. Optional parameters can be passed in. */ - get: operations["getOptionValues"]; - /** - * Creates a *Variant Option Value*. - * - * **Required Fields** - * * label - * * sort_order - * - * **Read-Only Fields** - * * id - */ - post: operations["createOptionValue"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `Option`. */ - option_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/options/{option_id}/values/{value_id}": { - /** Returns a single *Variant Option Value*. Optional parameters can be passed in. */ - get: operations["getOptionValueById"]; - /** - * Updates a *Variant Option Value*. - * - * **Read-Only Fields** - * * id - */ - put: operations["updateOptionValue"]; - /** Deletea a *Variant Option Value*. */ - delete: operations["deleteOptionValueById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `Option`. */ - option_id: unknown; - /** The ID of the `Modifier/Option Value`. */ - value_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/modifiers": { - /** Returns a list of all *Product Modifiers*. Optional parameters can be passed in. */ - get: operations["getModifiers"]; - /** - * Creates a *Product Modifier*. - * - * **Required Fields** - * * `required` - * * `display_name` - * * `type` - * - * **Read-Only Fields** - * * `id` - */ - post: operations["createModifier"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/modifiers/{modifier_id}": { - /** Returns a single *Product Modifier*. Optional parameters can be passed in. */ - get: operations["getModifierById"]; - /** Updates a *Product Modifier*. */ - put: operations["updateModifier"]; - /** Deletes a *Product Modifier*. */ - delete: operations["deleteModifierById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `Modifier`. */ - modifier_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/modifiers/{modifier_id}/values": { - /** Returns a list of all product *Modifier Values*. Optional parameters can be passed in. */ - get: operations["getModifierValues"]; - /** - * Creates a *Modifier Value*. - * - * **Required Fields** - * * label - * * sort_order - * - * **Read-Only Fields** - * * id - */ - post: operations["createModifierValue"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `Modifier`. */ - modifier_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/modifiers/{modifier_id}/values/{value_id}": { - /** Returns a single *Modifier Value*. Optional parameters can be passed in. */ - get: operations["getModifierValueById"]; - /** - * Updates a *Modifier Value*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - */ - put: operations["updateModifierValue"]; - /** Deletes a *Modifier Value*. */ - delete: operations["deleteModifierValueById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `Modifier`. */ - modifier_id: unknown; - /** The ID of the `Modifier/Option Value`. */ - value_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/modifiers/{modifier_id}/values/{value_id}/image": { - /** - * Creates a *Modifier Image*. - * - * The image will show on the storefront when the value is selected. - * - * **Required Fields** - * - image_file: Form posts are the only accepted upload option. - */ - post: operations["createModifierImage"]; - /** - * Deletes a *Modifier Image*. - * - * Deletes the image that was set to show when the modifier value is selected. - */ - delete: operations["deleteModifierImage"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `Modifier`. */ - modifier_id: unknown; - /** The ID of the `Modifier`. */ - value_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/complex-rules": { - /** Returns a list of all product *Complex Rules*. Optional parameters may be passed in. */ - get: operations["getComplexRules"]; - /** - * Creates a product *Complex Rule*. - * - * **Required Fields** - * - modifier_id - * - modifier_value_id - * - modifier_value_id - * - variant_id - * - * **Read-Only Fields** - * - complex_rule_id - * - conditions_id - * - rule_id - * - combination_id - * - id - */ - post: operations["createComplexRule"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/complex-rules/{complex_rule_id}": { - /** Returns a single *Complex Rule*. Optional parameters can be passed in. */ - get: operations["getComplexRuleById"]; - /** - * Updates a *Complex Rule*. - * - * **Required Fields**: - * - none - * - * **Read-Only Fields**: - * - complex_rule_id - * - conditions_id - * - rule_id - * - combination_id - * - id - */ - put: operations["updateComplexRule"]; - /** Deletes a product *Complex Rule*. */ - delete: operations["deleteComplexRuleById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `ComplexRule`. */ - complex_rule_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/custom-fields": { - /** Returns a list of product *Custom Fields*. Optional parameters can be passed in. */ - get: operations["getCustomFields"]; - /** - * Creates a *Custom Field*. - * - * **Required Fields:** - * - name - * - value - * - * **Read-Only:** - * - id - */ - post: operations["createCustomField"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/custom-fields/{custom_field_id}": { - /** Returns a single *Custom Field*. Optional parameters can be passed in. */ - get: operations["getCustomFieldById"]; - /** - * Updates a *Custom Field*. - * - * **Required Fields** - * - none - * - * **Read-Only** - * - id - */ - put: operations["updateCustomField"]; - /** Deletes a product *Custom Field*. */ - delete: operations["deleteCustomFieldById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `CustomField`. */ - custom_field_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/bulk-pricing-rules": { - /** Returns a list of *Bulk Pricing Rules*. Optional parameters can be passed in. */ - get: operations["getBulkPricingRules"]; - /** - * Creates a *Bulk Pricing Rule*. - * - * **Required Fields** - * - quantity_min - * - quantity_max - * - type - * - amount - * - * **Read-Only Fields** - * - id - */ - post: operations["createBulkPricingRule"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - }; - }; - }; - "/catalog/products/{product_id}/bulk-pricing-rules/{bulk_pricing_rule_id}": { - /** Returns a single *Bulk Pricing Rule*. Optional parameters can be passed in. */ - get: operations["getBulkPricingRuleById"]; - /** - * Updates a *Bulk Pricing Rule*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * - id - */ - put: operations["updateBulkPricingRule"]; - /** Deletes a *Bulk Pricing Rule*. */ - delete: operations["deleteBulkPricingRuleById"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `BulkPricingRule`. */ - bulk_pricing_rule_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/metafields": { - /** Returns a list of *Product Metafields*. Optional parameters can be passed in. */ - get: operations["getProductMetafieldsByProductId"]; - /** - * Creates a *Product Metafield*. - * - * **Required Fields:** - * * permission_set - * * namespace - * * key - * * value - * - * **Read-Only Fields** - * * id - * - * **Note:** The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - post: operations["createProductMetafield"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/metafields/{metafield_id}": { - /** Returns a single *Product Metafield*. Optional parameters can be passed in. */ - get: operations["getProductMetafieldByProductId"]; - /** - * Updates a *Product Metafield*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - * * These fields can only be modified by the app (API credentials) that created the metafield: - * * namespace - * * key - * * permission_set - * - * **Usage Notes** - * * Attempting to modify `namespace`, `key`, and `permission_set` fields using a client ID different from the one used to create those metafields will result in a 403 error message. - */ - put: operations["updateProductMetafield"]; - /** Deletes a *Product Metafield*. */ - delete: operations["deleteProductMetafieldById"]; - parameters: { - path: { - /** The ID of the `Metafield`. */ - metafield_id: unknown; - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/reviews": { - /** Returns a list of all *Product Reviews*. Optional parameters can be passed in. */ - get: operations["getProductReviews"]; - /** - * Creates a *Product Review*. - * - * **Required Fields** - * - title - * - date_reviewed - * - * **Read-Only Fields** - * * id - */ - post: operations["createProductReview"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - }; - }; - }; - "/catalog/products/{product_id}/reviews/{review_id}": { - /** Returns a single *Product Review*. Optional parameters maybe passed in. */ - get: operations["getProductReviewById"]; - /** - * Updates a *Product Review*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - */ - put: operations["updateProductReview"]; - /** Deletes a *Product Review*. */ - delete: operations["deleteProductReview"]; - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** The ID of the `review` that is being operated on. */ - review_id: unknown; - }; - }; - }; - "/catalog/categories": { - /** Returns a list of *Categories*. Optional filter parameters can be passed in. */ - get: operations["getCategories"]; - /** - * Creates a *Category*. - * - * **Required Fields**: - * - parent_id: - * - To create a child category, set the parent_id to the parent category. - * - To create a top level category, set the parent_id to 0. - * - name - * - * **Read-Only Fields**: - * - id - */ - post: operations["createCategory"]; - /** - * By default, it deletes all *Category* objects. A filter should be added to avoid deleting all *Category* objects in a store. - * - * Sending a `DELETE` to this endpoint will result in a `422` error. Move products to a new category by sending a `PUT` to the `/catalog/products/{product_id}` endpoint before deleting a category. - */ - delete: operations["deleteCategories"]; - }; - "/catalog/categories/{category_id}": { - /** Returns a single *Category*. Optional parameters can be passed in. */ - get: operations["getCategoryById"]; - /** - * Updates a *Category*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * - id - */ - put: operations["updateCategory"]; - /** Deletes a *Category*. */ - delete: operations["deleteCategoryById"]; - parameters: { - path: { - /** The ID of the `Category` to which the resource belongs. */ - category_id: unknown; - }; - }; - }; - "/catalog/categories/{category_id}/metafields": { - /** Returns a list of *Metafields* on a *Category*. Optional filter parameters can be passed in. */ - get: operations["getCategoryMetafieldsByCategoryId"]; - /** - * Creates a *Category Metafield*. - * - * **Required Fields:** - * - permission_set - * - namespace - * - key - * - value - * - * **Read-Only Fields** - * - id - * - * **Note:** The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - post: operations["createCategoryMetafield"]; - parameters: { - path: { - /** The ID of the `Category` to which the resource belongs. */ - category_id: unknown; - }; - }; - }; - "/catalog/categories/{category_id}/metafields/{metafield_id}": { - /** Returns a single *Category Metafield*. Optional parameters can be passed in. */ - get: operations["getCategoryMetafieldByCategoryId"]; - /** - * Updates a *Category Metafield*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - * * These fields can only be modified by the app (API credentials) that created the metafield: - * * namespace - * * key - * * permission_set - * - * **Usage Notes** - * * Attempting to modify `namespace`, `key`, and `permission_set` fields using a client ID different from the one used to create those metafields will result in a 403 error message. - */ - put: operations["updateCategoryMetafield"]; - /** Deletes a *Category Metafield*. */ - delete: operations["deleteCategoryMetafieldById"]; - parameters: { - path: { - /** The ID of the `Metafield`. */ - metafield_id: unknown; - /** The ID of the `Category` to which the resource belongs. */ - category_id: unknown; - }; - }; - }; - "/catalog/categories/{category_id}/image": { - /** - * Create a *Category Image*. - * - * **Required Fields** - * - image_file: Form posts are the only accepted upload option. - * - * Only one image at a time can be created. - * Limit image size to 1MB. - * To update a *Category Image*, use the [PUT Categories](/api-reference/catalog/catalog-api/category/updatecategory) and an `image_url`. - */ - post: operations["createCategoryImage"]; - /** Deletes a *Cateogory Image*. */ - delete: operations["deleteCategoryImage"]; - parameters: { - path: { - /** The ID of the `Category` to which the resource belongs. */ - category_id: unknown; - }; - }; - }; - "/catalog/categories/tree": { - /** Returns the categories tree, a nested lineage of the categories with parent->child relationship. The Category objects returned are simplified versions of the category objects returned in the rest of this API. */ - get: operations["getCategoryTree"]; - }; - "/catalog/brands": { - /** Returns a list of *Brands*. Optional filter parameters can be passed in. */ - get: operations["getBrands"]; - /** - * Creates a *Brand*. - * - * **Required Fields** - * - name - * - * **Read-Only Fields** - * - id - */ - post: operations["createBrand"]; - /** By default, it deletes all *Brand* objects. A filter should be added to avoid deleting all *Brand* objects in a store. */ - delete: operations["deleteBrands"]; - }; - "/catalog/brands/{brand_id}": { - /** Returns a single *Brand*. Optional filter parameters can be passed in. */ - get: operations["getBrandById"]; - /** - * Updates a *Brand*. - * - * **Required Fields** - * - None - * - * **Read-Only Fields** - * - id - * - * To update a *Brand Image*, send a request with an `image_url`. - */ - put: operations["updateBrand"]; - /** Deletes a *Brand*. */ - delete: operations["deleteBrandById"]; - parameters: { - path: { - /** The ID of the `Brand` to which the resource belongs. */ - brand_id: unknown; - }; - }; - }; - "/catalog/brands/{brand_id}/metafields": { - /** Returns a list of *Brand Metafields*. Optional filter parameters can be passed in. */ - get: operations["getBrandMetafieldsByBrandId"]; - /** - * Creates a *Brand Metafield*. - * - * **Required Fields** - * - permission_set - * - namespace - * - key - * - value - * - * **Read-Only Fields** - * - id - * - * **Note:** The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - post: operations["createBrandMetafield"]; - parameters: { - path: { - /** The ID of the `Brand` to which the resource belongs. */ - brand_id: unknown; - }; - }; - }; - "/catalog/brands/{brand_id}/metafields/{metafield_id}": { - /** Returns a *Brand Metafield*. Optional filter parameters can be passed in. */ - get: operations["getBrandMetafieldByBrandId"]; - /** - * Updates a *Brand Metafield*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - * * These fields can only be modified by the app (API credentials) that created the metafield: - * * namespace - * * key - * * permission_set - * - * **Usage Notes** - * * Attempting to modify `namespace`, `key`, and `permission_set` fields using a client ID different from the one used to create those metafields will result in a 403 error message. - * * The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - put: operations["updateBrandMetafield"]; - /** Deletes a *Brand Metafield*. */ - delete: operations["deleteBrandMetafieldById"]; - parameters: { - path: { - /** The ID of the `Metafield`. */ - metafield_id: unknown; - /** The ID of the `Brand` to which the resource belongs. */ - brand_id: unknown; - }; - }; - }; - "/catalog/brands/{brand_id}/image": { - /** - * Creates a *Brand Image*. - * - * **Required Fields** - * - image_file: Form posts are the only accepted upload option. - * - * **Read-Only Fields** - * - id - * - * Only one image at a time can be created. To update a *Brand Image*, use the [PUT Brands](/api-reference/catalog/catalog-api/brands/updatebrand) and an `image_url`. - */ - post: operations["createBrandImage"]; - /** Deletes a *Brand Image*. */ - delete: operations["deleteBrandImage"]; - parameters: { - path: { - /** The ID of the `Brand` to which the resource belongs. */ - brand_id: unknown; - }; - }; - }; - "/catalog/variants": { - /** Returns a list of all variants in your catalog. Optional parameters can be passed in. */ - get: operations["getVariants"]; - /** Creates or updates a batch of `Variant` objects. At the time of writing, the current limit is `50` variants. This limit is subject to change. */ - put: operations["updateVariantsBatch"]; - }; - "/catalog/summary": { - /** - * Returns a lightweight inventory summary from the BigCommerce Catalog. - * - * The inventory summary includes: - * * "inventory_count" - * * "variant_count" - * * "inventory_value" - * * "highest_variant_price" - * * "average_variant_price" - * * "lowest_variant_price" - * * "oldest_variant_date" - * * "newest_variant_date" - * * "primary_category_id" - * * "primary_category_name" - */ - get: operations["getCatalogSummary"]; - }; -} -export interface definitions { - /** Common Modifier properties. */ - productModifier_Base: { - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - config?: definitions["config_Full"]; - /** The name of the option shown on the storefront. */ - display_name?: string; - }; - /** Product Modifier */ - productModifier_Full: definitions["productModifier_Base"] & { - /** The unique numeric ID of the modifier; increments sequentially. */ - id?: number; - /** The unique numeric ID of the product to which the option belongs. */ - product_id?: number; - /** The unique option name. Auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - option_values?: definitions["productModifierOptionValue_Full"][]; - }; - /** The model for a POST to create a modifier on a product. */ - productModifier_Post: { - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - option_values?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - } & { - /** The name of the option shown on the storefront. */ - display_name: string; - }; - /** The model for a PUT to update a modifier on a product. */ - productModifier_Put: { - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - option_values?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - }; - /** Common Product Modifer `option_value` properties. */ - productModifierOptionValue_Base: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. If no data is available, returns `null`. */ - value_data?: { - [key: string]: any; - }; - adjusters?: definitions["adjusters_Full"]; - }; - /** Product Modifer `option_value`. */ - productModifierOptionValue_Full: definitions["productModifierOptionValue_Base"] & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - option_id?: number; - }; - /** The model for a POST to create a modifier value on a product. */ - productModifierOptionValue_Post: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }; - /** The model for a PUT to update a modifier value on a product. */ - productModifierOptionValue_Put: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - resp_productionOption: { - data?: definitions["productOption_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - ""?: string; - }; - }; - /** Common Option properties. */ - productOption_Base: { - /** The unique numerical ID of the option, increments sequentially. */ - id?: number; - /** The unique numerical ID of the product to which the option belongs. */ - product_id?: number; - /** The name of the option shown on the storefront. */ - display_name?: string; - /** The type of option, which determines how it will display on the storefront. Acceptable values: `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. For reference, the former v2 API values are: RB = radio_buttons, RT = rectangles, S = dropdown, P = product_list, PI = product_list_with_images, CS = swatch. */ - type?: "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - config?: definitions["productOptionConfig_Full"]; - /** Order in which the option is displayed on the storefront. */ - sort_order?: number; - option_values?: definitions["productOptionOptionValue_Full"]; - }; - productOption_Full: definitions["productOption_Base"] & { - /** The unique option name, auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - }; - /** The model for a POST to create options on a product. */ - productOption_Post: { - /** The unique numerical ID of the option, increments sequentially. */ - id?: number; - /** The unique numerical ID of the product to which the option belongs. */ - product_id?: number; - /** The name of the option shown on the storefront. */ - display_name?: string; - /** The type of option, which determines how it will display on the storefront. Acceptable values: `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. For reference, the former v2 API values are: RB = radio_buttons, RT = rectangles, S = dropdown, P = product_list, PI = product_list_with_images, CS = swatch. */ - type?: "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - /** Order in which the option is displayed on the storefront. */ - sort_order?: number; - option_values?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - /** Publicly available image url */ - image_url?: string; - }; - /** The model for a PUT to update options on a product. */ - productOption_Put: { - /** The unique numerical ID of the option, increments sequentially. */ - id?: number; - /** The unique numerical ID of the product to which the option belongs. */ - product_id?: number; - /** The name of the option shown on the storefront. */ - display_name?: string; - /** The type of option, which determines how it will display on the storefront. Acceptable values: `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. For reference, the former v2 API values are: RB = radio_buttons, RT = rectangles, S = dropdown, P = product_list, PI = product_list_with_images, CS = swatch. */ - type?: "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - /** Order in which the option is displayed on the storefront. */ - sort_order?: number; - option_values?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - /** Publicly available image url */ - image_url?: string; - }; - /** Returns the categories tree, a nested lineage of the categories with parent->child relationship. The Category objects returned are simplified versions of the category objects returned in the rest of this API. */ - categoriesTree_Resp: { - data?: definitions["categoriesTreeNode_Full"][]; - meta?: definitions["metaEmpty_Full"]; - }; - /** Used to reflect parent <> child category relationships. Used by Category Tree. */ - categoriesTreeNode_Full: { - /** The unique numeric ID of the category; increments sequentially. */ - id?: number; - /** The unique numeric ID of the category's parent. This field controls where the category sits in the tree of categories that organize the catalog. */ - parent_id?: number; - /** The name displayed for the category. Name is unique with respect to the category's siblings. */ - name?: string; - /** Flag to determine whether the product should be displayed to customers browsing the store. If `true`, the category will be displayed. If `false`, the category will be hidden from view. */ - is_visible?: boolean; - /** The custom URL for the category on the storefront. */ - url?: string; - /** The list of children of the category. */ - children?: definitions["categoriesTreeNode_Full"][]; - }; - /** Common Category object properties. */ - category_Full: { - /** - * Unique ID of the *Category*. Increments sequentially. - * Read-Only. - */ - id?: number; - /** - * The unique numeric ID of the category's parent. This field controls where the category sits in the tree of categories that organize the catalog. - * Required in a POST if creating a child category. - */ - parent_id: number; - /** - * The name displayed for the category. Name is unique with respect to the category's siblings. - * Required in a POST. - */ - name: string; - /** The product description, which can include HTML formatting. */ - description?: string; - /** Number of views the category has on the storefront. */ - views?: number; - /** Priority this category will be given when included in the menu and category pages. The lower the number, the closer to the top of the results the category will be. */ - sort_order?: number; - /** Custom title for the category page. If not defined, the category name will be used as the meta title. */ - page_title?: string; - /** A comma-separated list of keywords that can be used to locate the category when searching the store. */ - search_keywords?: string; - /** Custom meta keywords for the category page. If not defined, the store's default keywords will be used. Must post as an array like: ["awesome","sauce"]. */ - meta_keywords?: string[]; - /** Custom meta description for the category page. If not defined, the store's default meta description will be used. */ - meta_description?: string; - /** A valid layout file. (Please refer to [this article](https://support.bigcommerce.com/articles/Public/Creating-Custom-Template-Files/) on creating category files.) This field is writable only for stores with a Blueprint theme applied. */ - layout_file?: string; - /** Flag to determine whether the product should be displayed to customers browsing the store. If `true`, the category will be displayed. If `false`, the category will be hidden from view. */ - is_visible?: boolean; - /** Determines how the products are sorted on category page load. */ - default_product_sort?: "use_store_settings" | "featured" | "newest" | "best_selling" | "alpha_asc" | "alpha_desc" | "avg_customer_review" | "price_asc" | "price_desc"; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/categories/{categoryId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - custom_url?: definitions["customUrl_Full"]; - }; - /** Common Brand properties. */ - brand_Full: { - /** Unique ID of the *Brand*. Read-Only. */ - id?: number; - /** - * The name of the brand. Must be unique. - * Required in POST. - */ - name: string; - /** The title shown in the browser while viewing the brand. */ - page_title?: string; - /** Comma-separated list of meta keywords to include in the HTML. */ - meta_keywords?: string[]; - /** A meta description to include. */ - meta_description?: string; - /** A comma-separated list of keywords that can be used to locate this brand. */ - search_keywords?: string; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/brands/{brandId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - custom_url?: definitions["customUrl_Full"]; - }; - /** Common Variant properties. */ - productVariant_Base: { - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - }; - productVariant_Full: definitions["productVariant_Base"] & { - id?: number; - product_id?: number; - sku?: string; - /** Read-only reference to v2 API's SKU ID. Null if it is a base variant. */ - sku_id?: number; - /** Array of option and option values IDs that make up this variant. Will be empty if the variant is the product's base variant. */ - option_values?: definitions["productVariantOptionValue_Full"][]; - /** The price of the variant as seen on the storefront. This price takes into account `sale_price` and any price adjustment rules that are applicable to this variant. */ - calculated_price?: number; - ""?: string; - }; - /** The model for a POST to create variants on a product. */ - productVariant_Post: { - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - } & { - product_id?: number; - sku?: string; - /** Array of option and option values IDs that make up this variant. Will be empty if the variant is the product's base variant. */ - option_values?: definitions["productVariantOptionValue_Full"][]; - }; - variantCollection_Put: definitions["productVariant_Full"][]; - /** The model for a PUT to update variants on a product. */ - variant_Put: { - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - } & { - id?: number; - }; - /** The model for a POST to create variants on a product. */ - productVariant_Post_Product: definitions["productVariant_Base"] & { - sku?: string; - option_values?: { - /** The name of the option. */ - option_display_name?: string; - /** The label of the option value. */ - label?: string; - }[]; - }; - /** The model for a PUT to update variants on a product. */ - productVariant_Put_Product: { - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - product_id?: number; - sku?: string; - }; - productVariantOptionValue_Full: { - /** The name of the option. */ - option_display_name?: string; - /** The label of the option value. */ - label?: string; - } & definitions["productVariantOptionValue_Base"]; - /** The model for a POST to create option values on a product. */ - productOptionValue_Post_Product: { - /** The name of the option. */ - option_display_name?: string; - /** The label of the option value. */ - label?: string; - }; - /** Common Product Variant Option properties. */ - productVariantOptionValue_Base: { - /** `option_value` ID. */ - id?: number; - /** `option` ID. */ - option_id?: number; - }; - /** The model for a POST to create option values on a variant. */ - productVariantOptionValue_Post: { - id?: number; - option_id?: number; - }; - resp_productOptionValue: { - data?: definitions["productOptionOptionValue_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - ""?: string; - }; - }; - /** Common Product Option `option_value` properties. */ - productOptionOptionValue_Base: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. If no data is available, returns `null`. */ - value_data?: { - [key: string]: any; - }; - }; - /** Product Option `option_value`. */ - productOptionOptionValue_Full: definitions["productOptionOptionValue_Base"] & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** The model for a POST to create option values on a product. */ - productOptionValue_Post: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - }; - /** The model for a PUT to update option values on a product. */ - productOptionValue_Put: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** Common ProductImage properties. */ - productImage_Base: { - /** The local path to the original image file uploaded to BigCommerce. */ - image_file?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - /** Must be a fully qualified URL path, including protocol. Limit of 8MB per file. */ - image_url?: string; - }; - /** The model for a POST to create an image on a product. */ - productImage_Post: { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - } & { - /** Must be a fully qualified URL path, including protocol. Limit of 8MB per file. */ - image_url?: string; - /** Must be sent as a multipart/form-data field in the request body. */ - image_file?: string; - }; - /** The model for a PUT to update applicable Product Image fields. */ - productImage_Put: { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - }; - /** The model for a POST to create a video on a product. */ - productVideo_Base: { - /** The title for the video. If left blank, this will be filled in according to data on a host site. */ - title?: string; - /** The description for the video. If left blank, this will be filled in according to data on a host site. */ - description?: string; - /** The order in which the video will be displayed on the product page. Higher integers give the video a lower priority. When updating, if the video is given a lower priority, all videos with a `sort_order` the same as or greater than the video's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The video type (a short name of a host site). */ - type?: "youtube"; - /** The ID of the video on a host site. */ - video_id?: string; - }; - /** A product video model. */ - productVideo_Full: definitions["productVideo_Base"] & { - /** The unique numeric ID of the product video; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** Length of the video. This will be filled in according to data on a host site. */ - length?: string; - }; - /** The model for a POST to create a video on a product. */ - productVideo_Post: definitions["productVideo_Base"]; - /** The model for a PUT to update a video on a product. */ - productVideo_Put: definitions["productVideo_Base"] & { - /** The unique numeric ID of the product video; increments sequentially. */ - id?: number; - }; - productReview_Base: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - }; - /** A product review model. */ - productReview_Full: definitions["productReview_Base"] & { - /** The unique numeric ID of the product review; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the review is associated. */ - product_id?: number; - /** Date the product review was created. */ - date_created?: string; - /** Date the product review was modified. */ - date_modified?: string; - }; - /** The model for a POST to create a product review. */ - productReview_Post: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - }; - /** The model for a PUT to update a product review. */ - productReview_Put: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - }; - /** - * Image Response returns for: - * * Create Variant Image - * * Create Modifier Image - * * Create Category Image - * * Create Brand Image - */ - resp_productImage: { - data?: definitions["productImage_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - /** An object containing a publicly accessible image URL, or a form post that contains an image file. */ - resourceImage_Full: { - /** A public URL for a GIF, JPEG, or PNG image. Limit of 8MB per file. */ - image_url?: string; - }; - /** The model for a POST to create a product. */ - product_Post: definitions["product_Base"] & { - variants?: definitions["productVariant_Post_Product"]; - }; - /** The model for a PUT to update a product. */ - product_Put: { - /** The unique numerical ID of the product; increments sequentially. */ - id?: number; - } & definitions["product_Base"] & { - variants?: definitions["productVariant_Put_Product"]; - }; - /** Catalog Summary object describes a lightweight summary of the catalog. */ - catalogSummary_Full: { - /** A count of all inventory items in the catalog. */ - inventory_count?: number; - /** Total value of store's inventory. */ - inventory_value?: number; - /** ID of the category containing the most products. */ - primary_category_id?: number; - /** Name of the category containing the most products. */ - primary_category_name?: string; - /** Total number of variants */ - variant_count?: number; - /** Highest priced variant */ - highest_variant_price?: number; - /** Average price of all variants */ - average_variant_price?: number; - /** Lowest priced variant in the store */ - lowest_variant_price?: string; - oldest_variant_date?: string; - newest_variant_date?: string; - }; - /** Metafield for products, categories, variants, and brands. The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. */ - metafield_Base: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - /** - * Determines the visibility and writeability of the field by other API consumers. - * - * |Value|Description - * |-|-| - * |`app_only`|Private to the app that owns the field| - * |`read`|Visible to other API consumers| - * |`write`|Open for reading and writing by other API consumers| - * |`read_and_sf_access`|Visible to other API consumers, including on storefront| - * |`write_and_sf_access`|Open for reading and writing by other API consumers, including on storefront| - */ - permission_set: "app_only" | "read" | "write" | "read_and_sf_access" | "write_and_sf_access"; - /** Namespace for the metafield, for organizational purposes. This is set set by the developer. Required for POST. */ - namespace: string; - /** The name of the field, for example: `location_id`, `color`. Required for POST. */ - key: string; - /** The value of the field, for example: `1`, `blue`. Required for POST. */ - value: string; - /** Description for the metafields. */ - description?: string; - /** The type of resource with which the metafield is associated. */ - resource_type?: "category" | "brand" | "product" | "variant"; - /** The ID for the resource with which the metafield is associated. */ - resource_id?: number; - /** Date and time of the metafield's creation. Read-Only. */ - date_created?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - date_modified?: string; - }; - /** Common ComplexRule properties. */ - complexRule_Base: { - /** - * The unique numeric ID of the rule; increments sequentially. - * Read-Only - */ - id?: number; - /** The unique numeric ID of the product with which the rule is associated; increments sequentially. */ - product_id?: number; - /** The priority to give this rule when making adjustments to the product properties. */ - sort_order?: number; - /** Flag for determining whether the rule is to be used when adjusting a product's price, weight, image, or availabilty. */ - enabled?: boolean; - /** Flag for determining whether other rules should not be applied after this rule has been applied. */ - stop?: boolean; - /** Flag for determining whether the rule should disable purchasing of a product when the conditions are applied. */ - purchasing_disabled?: boolean; - /** Message displayed on the storefront when a rule disables the purchasing of a product. */ - purchasing_disabled_message?: string; - /** Flag for determining whether the rule should hide purchasing of a product when the conditions are applied. */ - purchasing_hidden?: boolean; - /** The URL for an image displayed on the storefront when the conditions are applied. Limit of 8MB per file. */ - image_url?: string; - price_adjuster?: definitions["adjuster_Full"]; - weight_adjuster?: definitions["adjuster_Full"]; - conditions?: definitions["complexRuleConditionBase"][]; - }; - /** Gets custom fields associated with a product. These allow you to specify additional information that will appear on the product's page, such as a book's ISBN or a DVD's release date. */ - productCustomField_Base: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }; - /** The model for a POST to create a custom field on a product. */ - productCustomField_Post: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }; - /** The model for a PUT to update a custom field on a product. */ - productCustomField_Put: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }; - /** Complex rules may return with conditions that apply to one or more variants, or with a single modifier value (if the rules were created using the v2 API or the control panel). Complex rules created or updated in the v3 API must have conditions that either reference multiple `modifier_value_id`'s, or else reference a `modifier_value_id` and a `variant_id`. */ - complexRuleConditionBase: { - /** The unique numeric ID of the rule condition; increments sequentially. Read-Only */ - id?: number; - /** - * The unique numeric ID of the rule with which the condition is associated. - * Read-Only - */ - rule_id?: number; - /** - * The unique numeric ID of the modifier with which the rule condition is associated. - * Required in /POST. - */ - modifier_id: number; - /** - * The unique numeric ID of the modifier value with which the rule condition is associated. - * Required in /POST. - */ - modifier_value_id: number; - /** - * The unique numeric ID of the variant with which the rule condition is associated. - * Required in /POST. - */ - variant_id: number; - /** (READ-ONLY:) The unique numeric ID of the SKU (v2 API), or Combination, with which the rule condition is associated. This is to maintain cross-compatibility between v2 and v3. */ - combination_id?: number; - }; - /** The custom URL for the product on the storefront. */ - customUrl_Full: { - /** Product URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - /** Common Bulk Pricing Rule properties */ - bulkPricingRule_Full: { - /** Unique ID of the *Bulk Pricing Rule*. Read-Only. */ - id?: number; - /** - * The minimum inclusive quantity of a product to satisfy this rule. Must be greater than or equal to zero. - * Required in /POST. - */ - quantity_min: number; - /** - * The maximum inclusive quantity of a product to satisfy this rule. Must be greater than the `quantity_min` value – unless this field has a value of 0 (zero), in which case there will be no maximum bound for this rule. - * Required in /POST. - */ - quantity_max: number; - /** - * The type of adjustment that is made. Values: `price` - the adjustment amount per product; `percent` - the adjustment as a percentage of the original price; `fixed` - the adjusted absolute price of the product. - * Required in /POST. - */ - type: "price" | "percent" | "fixed"; - /** - * The discount can be a fixed dollar amount or a percentage. For a fixed dollar amount enter it as an integer and the response will return as an integer. For percentage enter the amount as the percentage divided by 100 using string format. For example 10% percent would be “.10”. The response will return as an integer. - * Required in /POST. - */ - amount: number; - }; - /** The values for option config can vary based on the Modifier created. */ - productOptionConfig_Full: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - /** Adjuster for Complex Rules. */ - adjuster_Full: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Errors during batch usage for the BigCommerce API. */ - resp_variantBatchError: { - batch_errors?: (definitions["error_Base"] & { - errors?: { - additionalProperties?: string; - }; - })[]; - }; - /** Data about the response, including pagination and collection totals. */ - metaCollection_Full: { - pagination?: definitions["pagination_Full"]; - }; - /** Data about the response, including pagination and collection totals. */ - pagination_Full: { - /** Total number of items in the result set. */ - total?: number; - /** Total number of items in the collection response. */ - count?: number; - /** The amount of items returned in the collection per page, controlled by the limit parameter. */ - per_page?: number; - /** The page you are currently on within the collection. */ - current_page?: number; - /** The total number of pages in the collection. */ - total_pages?: number; - /** Pagination links for the previous and next parts of the whole collection. */ - links?: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - }; - /** Empty meta object; may be used later. */ - metaEmpty_Full: { - [key: string]: any; - }; - errorResponse_Full: definitions["error_Base"] & { - errors?: definitions["detailedErrors"]; - }; - /** Error payload for the BigCommerce API. */ - error_Base: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - /** Error payload for the BigCommerce API. */ - errorNotFound: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - /** A gift-certificate model. */ - giftCertificate_Full: { - /** The gift-certificate code. */ - code?: string; - /** The balance on a gift certificate when it was purchased. */ - original_balance?: number; - /** The balance on a gift certificate at the time of this purchase. */ - starting_balance?: number; - /** The remaining balance on a gift certificate. */ - remaining_balance?: number; - /** The status of a gift certificate: `active` - gift certificate is active; `pending` - gift certificate purchase is pending; `disabled` - gift certificate is disabled; `expired` - gift certificate is expired. */ - status?: "active" | "pending" | "disabled" | "expired"; - }; - /** No-content response for the BigCommerce API. */ - errorNoContent: { - /** 204 HTTP status code. */ - status?: number; - /** The error title describing the situation. */ - title?: string; - type?: string; - instance?: string; - }; - detailedErrors: { - additionalProperties?: string; - }; - product_Full: definitions["product_Base"] & { - /** The date on which the product was created. */ - date_created?: string; - /** The date on which the product was modified. */ - date_modified?: string; - /** ID of the product. Read Only. */ - id?: number; - /** The unique identifier of the base variant associated with a simple product. This value is `null` for complex products. */ - base_variant_id?: number; - /** The price of the product as seen on the storefront. It will be equal to the `sale_price`, if set, and the `price` if there is not a `sale_price`. */ - calculated_price?: number; - options?: definitions["productOption_Base"][]; - modifiers?: definitions["productModifier_Full"][]; - /** Minimum Advertised Price. */ - map_price?: number; - /** Indicates that the product is in an Option Set (legacy V2 concept). */ - option_set_id?: number; - /** Legacy template setting which controls if the option set shows up to the side of or below the product image and description. */ - option_set_display?: string; - } & { - variants?: definitions["productVariant_Full"]; - }; - /** Common ProductImage properties. */ - productImage_Full: definitions["productImage_Base"] & { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - }; - metafield_Post: definitions["metafield_Base"]; - /** The model for batch updating products. */ - product_Put_Collection: ({ - /** The unique numerical ID of the product; increments sequentially. Required on batch product `PUT` requests. */ - id: number; - } & definitions["product_Base"])[]; - /** The values for option config can vary based on the Modifier created. */ - config_Full: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - adjusters_Full: { - price?: definitions["adjuster_Full"]; - weight?: definitions["adjuster_Full"]; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - /** - * Variant properties used on: - * * `/catalog/products/variants` - * * `/catalog/variants` - */ - variant_Base: { - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - }; - /** - * Shared `Product` properties used in: - * * `POST` - * * `PUT` - * * `GET` - */ - product_Base: { - /** The product name. */ - name: string; - /** The product type. One of: `physical` - a physical stock unit, `digital` - a digital download. */ - type: "physical" | "digital"; - /** User defined product code/stock keeping unit (SKU). */ - sku?: string; - /** The product description, which can include HTML formatting. */ - description?: string; - /** Weight of the product, which can be used when calculating shipping costs. This is based on the unit set on the store */ - weight: number; - /** Width of the product, which can be used when calculating shipping costs. */ - width?: number; - /** Depth of the product, which can be used when calculating shipping costs. */ - depth?: number; - /** Height of the product, which can be used when calculating shipping costs. */ - height?: number; - /** The price of the product. The price should include or exclude tax, based on the store settings. */ - price: number; - /** The cost price of the product. Stored for reference only; it is not used or displayed anywhere on the store. */ - cost_price?: number; - /** The retail cost of the product. If entered, the retail cost price will be shown on the product page. */ - retail_price?: number; - /** If entered, the sale price will be used instead of value in the price field when calculating the product's cost. */ - sale_price?: number; - /** The ID of the tax class applied to the product. (NOTE: Value ignored if automatic tax is enabled.) */ - tax_class_id?: number; - /** Accepts AvaTax System Tax Codes, which identify products and services that fall into special sales-tax categories. By using these codes, merchants who subscribe to BigCommerce's Avalara Premium integration can calculate sales taxes more accurately. Stores without Avalara Premium will ignore the code when calculating sales tax. Do not pass more than one code. The codes are case-sensitive. For details, please see Avalara's documentation. */ - product_tax_code?: string; - /** An array of IDs for the categories to which this product belongs. When updating a product, if an array of categories is supplied, all product categories will be overwritten. Does not accept more than 1,000 ID values. */ - categories?: number[]; - /** A product can be added to an existing brand during a product /PUT or /POST. */ - brand_id?: number; - /** Current inventory level of the product. Simple inventory tracking must be enabled (See the `inventory_tracking` field) for this to take any effect. */ - inventory_level?: number; - /** Inventory warning level for the product. When the product's inventory level drops below the warning level, the store owner will be informed. Simple inventory tracking must be enabled (see the `inventory_tracking` field) for this to take any effect. */ - inventory_warning_level?: number; - /** The type of inventory tracking for the product. Values are: `none` - inventory levels will not be tracked; `product` - inventory levels will be tracked using the `inventory_level` and `inventory_warning_level` fields; `variant` - inventory levels will be tracked based on variants, which maintain their own warning levels and inventory levels. */ - inventory_tracking?: "none" | "product" | "variant"; - /** A fixed shipping cost for the product. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** Flag used to indicate whether the product has free shipping. If `true`, the shipping cost for the product will be zero. */ - is_free_shipping?: boolean; - /** Flag to determine whether the product should be displayed to customers browsing the store. If `true`, the product will be displayed. If `false`, the product will be hidden from view. */ - is_visible?: boolean; - /** Flag to determine whether the product should be included in the `featured products` panel when viewing the store. */ - is_featured?: boolean; - /** An array of IDs for the related products. */ - related_products?: number[]; - /** Warranty information displayed on the product page. Can include HTML formatting. */ - warranty?: string; - /** The BIN picking number for the product. */ - bin_picking_number?: string; - /** The layout template file used to render this product category. This field is writable only for stores with a Blueprint theme applied. */ - layout_file?: string; - /** The product UPC code, which is used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** A comma-separated list of keywords that can be used to locate the product when searching the store. */ - search_keywords?: string; - /** Availability of the product. Availability options are: `available` - the product can be purchased on the storefront; `disabled` - the product is listed in the storefront, but cannot be purchased; `preorder` - the product is listed for pre-orders. */ - availability?: "available" | "disabled" | "preorder"; - /** Availability text displayed on the checkout page, under the product title. Tells the customer how long it will normally take to ship this product, such as: 'Usually ships in 24 hours.' */ - availability_description?: string; - /** Type of gift-wrapping options. Values: `any` - allow any gift-wrapping options in the store; `none` - disallow gift-wrapping on the product; `list` – provide a list of IDs in the `gift_wrapping_options_list` field. */ - gift_wrapping_options_type?: "any" | "none" | "list"; - /** A list of gift-wrapping option IDs. */ - gift_wrapping_options_list?: number[]; - /** Priority to give this product when included in product lists on category pages and in search results. Lower integers will place the product closer to the top of the results. */ - sort_order?: number; - /** The product condition. Will be shown on the product page if the `is_condition_shown` field's value is `true`. Possible values: `New`, `Used`, `Refurbished`. */ - condition?: "New" | "Used" | "Refurbished"; - /** Flag used to determine whether the product condition is shown to the customer on the product page. */ - is_condition_shown?: boolean; - /** The minimum quantity an order must contain, to be eligible to purchase this product. */ - order_quantity_minimum?: number; - /** The maximum quantity an order can contain when purchasing the product. */ - order_quantity_maximum?: number; - /** Custom title for the product page. If not defined, the product name will be used as the meta title. */ - page_title?: string; - /** Custom meta keywords for the product page. If not defined, the store's default keywords will be used. */ - meta_keywords?: string[]; - /** Custom meta description for the product page. If not defined, the store's default meta description will be used. */ - meta_description?: string; - /** The number of times the product has been viewed. */ - view_count?: number; - /** Pre-order release date. See the `availability` field for details on setting a product's availability to accept pre-orders. */ - preorder_release_date?: string; - /** Custom expected-date message to display on the product page. If undefined, the message defaults to the storewide setting. Can contain the `%%DATE%%` placeholder, which will be substituted for the release date. */ - preorder_message?: string; - /** - * If set to true then on the preorder release date the preorder status will automatically be removed. - * If set to false, then on the release date the preorder status **will not** be removed. It will need to be changed manually either in the - * control panel or using the API. Using the API set `availability` to `available`. - */ - is_preorder_only?: boolean; - /** False by default, indicating that this product's price should be shown on the product page. If set to `true`, the price is hidden. (NOTE: To successfully set `is_price_hidden` to `true`, the `availability` value must be `disabled`.) */ - is_price_hidden?: boolean; - /** By default, an empty string. If `is_price_hidden` is `true`, the value of `price_hidden_label` is displayed instead of the price. (NOTE: To successfully set a non-empty string value with `is_price_hidden` set to `true`, the `availability` value must be `disabled`.) */ - price_hidden_label?: string; - custom_url?: definitions["customUrl_Full"]; - /** Type of product, defaults to `product`. */ - open_graph_type?: "product" | "album" | "book" | "drink" | "food" | "game" | "movie" | "song" | "tv_show"; - /** Title of the product, if not specified the product name will be used instead. */ - open_graph_title?: string; - /** Description to use for the product, if not specified then the meta_description will be used instead. */ - open_graph_description?: string; - /** Flag to determine if product description or open graph description is used. */ - open_graph_use_meta_description?: boolean; - /** Flag to determine if product name or open graph name is used. */ - open_graph_use_product_name?: boolean; - /** Flag to determine if product image or open graph image is used. */ - open_graph_use_image?: boolean; - /** The brand can be created during a product PUT or POST request. If the brand already exists then the product will be added. If not the brand will be created and the product added. If using `brand_name` it performs a fuzzy match and adds the brand. eg. "Common Good" and "Common good" are the same. Brand name does not return as part of a product response. Only the `brand_id`. */ - "brand_name or brand_id"?: string; - /** Global Trade Item Number */ - gtin?: string; - /** Manufacturer Part Number */ - mpn?: string; - /** The total rating for the product. */ - reviews_rating_sum?: number; - /** The number of times the product has been rated. */ - reviews_count?: number; - /** The total quantity of this product sold. */ - total_sold?: number; - custom_fields?: definitions["productCustomField_Put"][]; - bulk_pricing_rules?: definitions["bulkPricingRule_Full"][]; - images?: definitions["productImage_Full"][]; - videos?: definitions["productVideo_Full"][]; - }; - /** Properties for updating metafields. */ - metafield_Put: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - } & definitions["metafield_Base"]; - metafield_Full: definitions["metafield_Put"] & { - /** Date and time of the metafield's creation. Read-Only. */ - date_created?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - date_modified?: string; - }; - /** The model for a PUT to update variants on a product. */ - productVariant_Put: definitions["productVariant_Base"] & { - product_id?: number; - sku?: string; - }; -} -export interface parameters { - /** The template file, for example: `pages/home`. */ - FilterTemplateFileParam: string; - /** Filter items by id. */ - FilterIdParam: number; - /** Filter items by sku. */ - FilterSkuParam: string; - /** Filter items by name. */ - FilterNameParam: string; - /** Filter items by email. */ - FilterEmailParam: string; - /** Filter items by source. */ - FilterSourceParam: string; - /** Filter items by order_id. */ - FilterOrderIdParam: number; - /** Filter items by upc. */ - FilterUpcParam: string; - /** Filter items by price. */ - FilterPriceParam: number; - /** Filter items by sale_price. */ - FilterSalePriceParam: number; - /** Filter items by retail_price. */ - FilterRetailPriceParam: number; - /** Filter items by map_price. */ - FilterMapPriceParam: number; - /** Filter items by calculated_price. */ - FilterCalculatedPriceParam: number; - /** Filter items by weight. */ - FilterWeightParam: number; - /** Filter items by condition. */ - FilterConditionParam: "new" | "used" | "refurbished"; - /** Filter items by brand_id. */ - FilterBrandIdParam: number; - /** Filter items by date_modified. For example `v3/catalog/products?date_modified:min=2018-06-15` */ - FilterDateModifiedParam: string; - /** Filter items by date_created. */ - FilterDateCreatedParam: string; - /** Filter items by date_last_imported. For example `v3/catalog/products?date_last_imported:min=2018-06-15` */ - FilterDateLastImportedParam: string; - /** Filter items by if visible on the storefront. */ - FilterIsVisibleParam: boolean; - /** Filter items by is_featured. */ - FilterIsFeaturedParam: number; - /** Filter items by is_free_shipping. */ - FilterIsFreeShippingParam: number; - /** Filter items by inventory_level. */ - FilterInventoryLevelParam: number; - /** Filter items by inventory_low. Values: 1, 0. */ - FilterInventoryLowParam: number; - /** Filter items by out_of_stock. To enable the filter, pass `out_of_stock`=`1`. */ - FilterOutOfStockParam: number; - /** Filter items by total_sold. */ - FilterTotalSoldParam: number; - /** Filter items by type: `physical` or `digital`. */ - ProductFilterTypeParam: "digital" | "physical"; - /** - * Filter items by categories. - * If a product is in more than one category, using this query will not return the product. Instead use `categories:in=12`. - */ - FilterCategoriesParam: number; - /** Filter items by keywords. eg. new, towel, bath */ - FilterKeywordParam: string; - /** Filter items by keywords found in the `name`, `description`, or `sku` fields, or in the brand name. */ - ProductFilterKeywordParam: string; - /** Set context for a product search. */ - ProductFilterKeywordContextParam: "shopper" | "merchant"; - /** Filter items by status. */ - FilterStatusParam: number; - /** Sub-resources to include on a product, in a comma-separated list. If `options` or `modifiers` is used, results are limited to 10 per page. */ - FilterIncludeParam: "variants" | "images" | "custom_fields" | "bulk_pricing_rules" | "primary_image" | "modifiers" | "options" | "videos"; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - FilterIncludeFieldsParam: string; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - FilterExcludeFieldsParam: string; - /** Filter items by parent_id. If the category is a child or sub category it can be filtered with the parent_id. */ - FilterParentIdParam: number; - /** Filter items by page_title. */ - FilterPageTitleParam: string; - /** Filter items by availability. Values are: available, disabled, preorder. */ - FilterAvailabilityParam: "available" | "disabled" | "preorder"; - /** - * This filter returns the product pricing with the *Price List* pricing instead. To use: - * `?price_list_id=1`. - * If there are variants use: - * `?price_list_id=1&include=variants` - */ - FilterPriceListIdParam: number; - /** A comma-separated list of ids of `Product`s whose prices were requested. */ - FilterProductIdParam: string; - /** The ID of the `Variant` whose prices were requested. */ - FilterVariantIdParam: number; - /** Filter items by currency. */ - FilterCurrencyParam: string; - /** Specifies the page number in a limited (paginated) list of products. */ - PageParam: number; - /** Controls the number of items per page in a limited (paginated) list of products. */ - LimitParam: number; - /** Sort direction. Acceptable values are: `asc`, `desc`. */ - DirectionParam: "asc" | "desc"; - /** Field name to sort by. */ - ProductSortParam: "id" | "name" | "sku" | "price" | "date_modified" | "date_last_imported" | "inventory_level" | "is_visible" | "total_sold"; - /** The ID of the `Product` to which the resource belongs. */ - ProductIdParam: number; - /** The ID of the `review` that is being operated on. */ - ReviewIdParam: number; - /** The ID of the `Image` that is being operated on. */ - ImageIdParam: number; - /** The BigCommerce ID of the `Video` */ - VideoIdParam: number; - /** The ID of the `ComplexRule`. */ - ComplexRuleIdParam: number; - /** The ID of the `ConfigurableField`. */ - ConfigurableFieldIdParam: number; - /** The ID of the `CustomField`. */ - CustomFieldIdParam: number; - /** The ID of the `BulkPricingRule`. */ - BulkPricingRuleIdParam: number; - /** The ID of the `Modifier`. */ - ModifierIdParam: number; - /** The ID of the `Modifier/Option Value`. */ - ValueIdParam: number; - /** The ID of the `Option`. */ - OptionIdParam: number; - /** ID of the variant on a product, or on an associated Price List Record. */ - VariantIdParam: number; - /** The ID of the `Category` to which the resource belongs. */ - CategoryIdParam: number; - /** The ID of the `Brand` to which the resource belongs. */ - BrandIdParam: number; - /** The ID of the `Metafield`. */ - MetafieldIdParam: number; - /** Filter based on a metafield's key. */ - MetafieldKeyParam: string; - /** Filter based on a metafield's namespace. */ - MetafieldNamespaceParam: string; - /** An image file. Supported MIME types include GIF, JPEG, and PNG. */ - ImageFileParam: { - [key: string]: any; - }; - /** The ID of the `Order` to which the transactions belong. */ - OrderIdParam: number; - Accept: string; - "Content-Type": string; - /** - * A comma-separated list of ids of Products whose prices were requested. For example: - * `?product_id=:id` - * `?product_id:in=77,80,81` - */ - product_id: string; - FilterIdIn: number[]; - FilterIdNotIn: number[]; - FilterIdMax: number[]; - FilterIdMin: number[]; - FilterIdGreater: number[]; - FilterIdLess: number[]; -} -export interface responses { - ProductCollectionResponse: { - schema: { - data?: definitions["product_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - BrandResponse: { - schema: { - /** Common Brand properties. */ - data?: { - /** Unique ID of the *Brand*. Read-Only. */ - id?: number; - /** - * The name of the brand. Must be unique. - * Required in POST. - */ - name: string; - /** The title shown in the browser while viewing the brand. */ - page_title?: string; - /** Comma-separated list of meta keywords to include in the HTML. */ - meta_keywords?: string[]; - /** A meta description to include. */ - meta_description?: string; - /** A comma-separated list of keywords that can be used to locate this brand. */ - search_keywords?: string; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/brands/{brandId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the brand on the storefront. */ - custom_url?: { - /** Brand URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - BrandCollectionResponse: { - schema: { - data?: { - /** Unique ID of the *Brand*. Read-Only. */ - id?: number; - /** - * The name of the brand. Must be unique. - * Required in POST. - */ - name: string; - /** The title shown in the browser while viewing the brand. */ - page_title?: string; - /** Comma-separated list of meta keywords to include in the HTML. */ - meta_keywords?: string[]; - /** A meta description to include. */ - meta_description?: string; - /** A comma-separated list of keywords that can be used to locate this brand. */ - search_keywords?: string; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/brands/{brandId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the brand on the storefront. */ - custom_url?: { - /** Brand URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - BrandImageUpload: { - schema: { - data?: { - image_url?: string; - }; - meta?: { - [key: string]: any; - }; - }; - }; - MetafieldCollectionResponse: { - schema: { - data?: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - /** Determines whether the field is completely private to the app that owns the field (`app_only`), or visible to other API consumers (`read`), or completely open for reading and writing to other apps (`write`). Required for POST. */ - permission_set: "app_only" | "read" | "write"; - /** Namespace for the metafield, for organizational purposes. This is set set by the developer. Required for POST. */ - namespace: string; - /** The name of the field, for example: `location_id`, `color`. Required for POST. */ - key: string; - /** The value of the field, for example: `1`, `blue`. Required for POST. */ - value: string; - /** Description for the metafields. */ - description?: string; - /** The type of resource with which the metafield is associated. */ - resource_type?: "category" | "brand" | "product" | "variant"; - /** The ID for the resource with which the metafield is associated. */ - resource_id?: number; - /** Date and time of the metafield's creation. Read-Only. */ - created_at?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - updated_at?: string; - }[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - MetafieldResponse: { - schema: { - /** Common Metafield properties. */ - data?: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - /** Determines whether the field is completely private to the app that owns the field (`app_only`), or visible to other API consumers (`read`), or completely open for reading and writing to other apps (`write`). Required for POST. */ - permission_set: "app_only" | "read" | "write"; - /** Namespace for the metafield, for organizational purposes. This is set set by the developer. Required for POST. */ - namespace: string; - /** The name of the field, for example: `location_id`, `color`. Required for POST. */ - key: string; - /** The value of the field, for example: `1`, `blue`. Required for POST. */ - value: string; - /** Description for the metafields. */ - description?: string; - /** The type of resource with which the metafield is associated. */ - resource_type?: "category" | "brand" | "product" | "variant"; - /** The ID for the resource with which the metafield is associated. */ - resource_id?: number; - /** Date and time of the metafield's creation. Read-Only. */ - created_at?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - updated_at?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - CategoryCollectionResponse: { - schema: { - data?: { - [key: string]: any; - }[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - CategoryResponse: { - schema: { - data?: definitions["category_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - ProductResponse: { - schema: { - data?: definitions["product_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - BulkPricingRuleResponse: { - schema: { - data?: definitions["bulkPricingRule_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - BulkPricingRuleCollectionResponse: { - schema: { - data?: definitions["bulkPricingRule_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - ComplexRuleCollectionResponse: { - schema: { - data?: { - /** - * The unique numeric ID of the rule; increments sequentially. - * Read-Only - */ - id?: number; - /** The unique numeric ID of the product with which the rule is associated; increments sequentially. */ - product_id?: number; - /** The priority to give this rule when making adjustments to the product properties. */ - sort_order?: number; - /** Flag for determining whether the rule is to be used when adjusting a product's price, weight, image, or availabilty. */ - enabled?: boolean; - /** Flag for determining whether other rules should not be applied after this rule has been applied. */ - stop?: boolean; - /** Flag for determining whether the rule should disable purchasing of a product when the conditions are applied. */ - purchasing_disabled?: boolean; - /** Message displayed on the storefront when a rule disables the purchasing of a product. */ - purchasing_disabled_message?: string; - /** Flag for determining whether the rule should hide purchasing of a product when the conditions are applied. */ - purchasing_hidden?: boolean; - /** The URL for an image displayed on the storefront when the conditions are applied. Limit of 8MB per file. */ - image_url?: string; - /** Adjuster for Complex Rules. */ - price_adjuster?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight_adjuster?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - conditions?: { - /** The unique numeric ID of the rule condition; increments sequentially. Read-Only */ - id?: number; - /** - * The unique numeric ID of the rule with which the condition is associated. - * Read-Only - */ - rule_id?: number; - /** - * The unique numeric ID of the modifier with which the rule condition is associated. - * Required in /POST. - */ - modifier_id: number; - /** - * The unique numeric ID of the modifier value with which the rule condition is associated. - * Required in /POST. - */ - modifier_value_id: number; - /** - * The unique numeric ID of the variant with which the rule condition is associated. - * Required in /POST. - */ - variant_id: number; - /** (READ-ONLY:) The unique numeric ID of the SKU (v2 API), or Combination, with which the rule condition is associated. This is to maintain cross-compatibility between v2 and v3. */ - combination_id?: number; - }[]; - }[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - ComplexRuleResponse: { - schema: { - /** Common ComplexRule properties. */ - data?: { - /** - * The unique numeric ID of the rule; increments sequentially. - * Read-Only - */ - id?: number; - /** The unique numeric ID of the product with which the rule is associated; increments sequentially. */ - product_id?: number; - /** The priority to give this rule when making adjustments to the product properties. */ - sort_order?: number; - /** Flag for determining whether the rule is to be used when adjusting a product's price, weight, image, or availabilty. */ - enabled?: boolean; - /** Flag for determining whether other rules should not be applied after this rule has been applied. */ - stop?: boolean; - /** Flag for determining whether the rule should disable purchasing of a product when the conditions are applied. */ - purchasing_disabled?: boolean; - /** Message displayed on the storefront when a rule disables the purchasing of a product. */ - purchasing_disabled_message?: string; - /** Flag for determining whether the rule should hide purchasing of a product when the conditions are applied. */ - purchasing_hidden?: boolean; - /** The URL for an image displayed on the storefront when the conditions are applied. Limit of 8MB per file. */ - image_url?: string; - /** Adjuster for Complex Rules. */ - price_adjuster?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight_adjuster?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - conditions?: { - /** The unique numeric ID of the rule condition; increments sequentially. Read-Only */ - id?: number; - /** - * The unique numeric ID of the rule with which the condition is associated. - * Read-Only - */ - rule_id?: number; - /** - * The unique numeric ID of the modifier with which the rule condition is associated. - * Required in /POST. - */ - modifier_id: number; - /** - * The unique numeric ID of the modifier value with which the rule condition is associated. - * Required in /POST. - */ - modifier_value_id: number; - /** - * The unique numeric ID of the variant with which the rule condition is associated. - * Required in /POST. - */ - variant_id: number; - /** (READ-ONLY:) The unique numeric ID of the SKU (v2 API), or Combination, with which the rule condition is associated. This is to maintain cross-compatibility between v2 and v3. */ - combination_id?: number; - }[]; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - CustomFieldCollectionResponse: { - schema: { - data?: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - CustomFieldResponse: { - schema: { - /** Gets custom fields associated with a product. These allow you to specify additional information that will appear on the product's page, such as a book's ISBN or a DVD's release date. */ - data?: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - ProductImageCollectionResponse: { - schema: { - data?: ({ - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - } & { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. Use image_url when creating a product. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** - * Publically available URL. - * Use the image_url when creating a product. - */ - image_url?: string; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - ProductImageResponse: { - schema: { - data?: { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - } & { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. Use image_url when creating a product. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** - * Publically available URL. - * Use the image_url when creating a product. - */ - image_url?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - ModifierCollectionResponse: { - schema: { - data?: ({ - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - option_values?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - } & { - /** The unique numeric ID of the modifier; increments sequentially. */ - id?: number; - /** The unique numeric ID of the product to which the option belongs. */ - product_id?: number; - /** The unique option name. Auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - /** The name of the option shown on the storefront. */ - display_name?: string; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - ModifierResponse: { - schema: { - /** Product Modifier */ - data?: { - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - option_values?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - } & { - /** The unique numeric ID of the modifier; increments sequentially. */ - id?: number; - /** The unique numeric ID of the product to which the option belongs. */ - product_id?: number; - /** The unique option name. Auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - /** The name of the option shown on the storefront. */ - display_name?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - ModifierValueCollectionResponse: { - schema: { - data?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - ModifierValueResponse: { - schema: { - /** Part of Modifier Value Response */ - data?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - OptionCollectionResponse: { - schema: { - data?: ({ - /** The unique numerical ID of the option, increments sequentially. */ - id?: number; - /** The unique numerical ID of the product to which the option belongs. */ - product_id?: number; - /** The name of the option shown on the storefront. */ - display_name?: string; - /** The type of option, which determines how it will display on the storefront. Acceptable values: `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. For reference, the former v2 API values are: RB = radio_buttons, RT = rectangles, S = dropdown, P = product_list, PI = product_list_with_images, CS = swatch. */ - type?: "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - /** Order in which the option is displayed on the storefront. */ - sort_order?: number; - option_values?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - /** Publicly available image url */ - image_url?: string; - } & { - /** The unique option name, auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - OptionResponse: { - schema: { - data?: { - /** The unique numerical ID of the option, increments sequentially. */ - id?: number; - /** The unique numerical ID of the product to which the option belongs. */ - product_id?: number; - /** The name of the option shown on the storefront. */ - display_name?: string; - /** The type of option, which determines how it will display on the storefront. Acceptable values: `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. For reference, the former v2 API values are: RB = radio_buttons, RT = rectangles, S = dropdown, P = product_list, PI = product_list_with_images, CS = swatch. */ - type?: "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - /** Order in which the option is displayed on the storefront. */ - sort_order?: number; - option_values?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - /** Publicly available image url */ - image_url?: string; - } & { - /** The unique option name, auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - OptionValueCollectionResponse: { - schema: { - data?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - OptionValueResponse: { - schema: { - data?: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - ProductReviewCollectionResponse: { - schema: { - data?: ({ - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - } & { - /** The unique numeric ID of the product review; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the review is associated. */ - product_id?: number; - /** Date the product review was created. */ - date_created?: string; - /** Date the product review was modified. */ - date_modified?: string; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - ProductReviewResponse: { - schema: { - /** A product review model. */ - data?: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - } & { - /** The unique numeric ID of the product review; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the review is associated. */ - product_id?: number; - /** Date the product review was created. */ - date_created?: string; - /** Date the product review was modified. */ - date_modified?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - VariantCollectionResponse: { - schema: { - data?: ({ - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - } & { - id?: number; - product_id?: number; - sku?: string; - /** Read-only reference to v2 API's SKU ID. Null if it is a base variant. */ - sku_id?: number; - /** Array of option and option values IDs that make up this variant. Will be empty if the variant is the product's base variant. */ - option_values?: ({ - /** The name of the option. */ - option_display_name?: string; - /** The label of the option value. */ - label?: string; - } & { - id?: number; - option_id?: number; - })[]; - /** The price of the variant as seen on the storefront. This price takes into account `sale_price` and any price adjustment rules that are applicable to this variant. */ - calculated_price?: number; - })[]; - /** Data about the response, including pagination and collection totals. */ - meta?: { - [key: string]: any; - }; - }; - }; - VariantResponse: { - schema: { - data?: { - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - } & { - id?: number; - product_id?: number; - sku?: string; - /** Read-only reference to v2 API's SKU ID. Null if it is a base variant. */ - sku_id?: number; - /** Array of option and option values IDs that make up this variant. Will be empty if the variant is the product's base variant. */ - option_values?: ({ - /** The name of the option. */ - option_display_name?: string; - /** The label of the option value. */ - label?: string; - } & { - id?: number; - option_id?: number; - })[]; - /** The price of the variant as seen on the storefront. This price takes into account `sale_price` and any price adjustment rules that are applicable to this variant. */ - calculated_price?: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - ProductVideoCollectionResponse: { - schema: { - data?: ({ - /** The title for the video. If left blank, this will be filled in according to data on a host site. */ - title?: string; - /** The description for the video. If left blank, this will be filled in according to data on a host site. */ - description?: string; - /** The order in which the video will be displayed on the product page. Higher integers give the video a lower priority. When updating, if the video is given a lower priority, all videos with a `sort_order` the same as or greater than the video's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The video type (a short name of a host site). */ - type?: "youtube"; - } & { - /** The unique numeric ID of the product video; increments sequentially. */ - id?: number; - /** The ID of the video on a host site. */ - video_id?: string; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** Length of the video. This will be filled in according to data on a host site. */ - length?: string; - })[]; - /** Data about the response, including pagination and collection totals. */ - meta?: { - [key: string]: any; - }; - }; - }; - ProductVideoResponse: { - schema: { - /** A product video model. */ - data?: { - /** The title for the video. If left blank, this will be filled in according to data on a host site. */ - title?: string; - /** The description for the video. If left blank, this will be filled in according to data on a host site. */ - description?: string; - /** The order in which the video will be displayed on the product page. Higher integers give the video a lower priority. When updating, if the video is given a lower priority, all videos with a `sort_order` the same as or greater than the video's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The video type (a short name of a host site). */ - type?: "youtube"; - } & { - /** The unique numeric ID of the product video; increments sequentially. */ - id?: number; - /** The ID of the video on a host site. */ - video_id?: string; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** Length of the video. This will be filled in according to data on a host site. */ - length?: string; - }; - meta?: definitions["metaEmpty_Full"]; - }; - }; - CatalogSummaryResponse: { - schema: { - /** Catalog Summary object describes a lightweight summary of the catalog. */ - data?: { - /** A count of all inventory items in the catalog. */ - inventory_count?: number; - /** Total value of store's inventory. */ - inventory_value?: number; - /** ID of the category containing the most products. */ - primary_category_id?: number; - /** Name of the category containing the most products. */ - primary_category_name?: string; - /** Total number of variants */ - variant_count?: number; - /** Highest priced variant */ - highest_variant_price?: number; - /** Average price of all variants */ - average_variant_price?: number; - /** Lowest priced variant in the store */ - lowest_variant_price?: string; - oldest_variant_date?: string; - newest_variant_date?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - CatalogVariantCollectionResponse: { - schema: { - data?: ({ - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - } & { - id?: number; - product_id?: number; - sku?: string; - /** Read-only reference to v2 API's SKU ID. Null if it is a base variant. */ - sku_id?: number; - /** Array of option and option values IDs that make up this variant. Will be empty if the variant is the product's base variant. */ - option_values?: ({ - /** The name of the option. */ - option_display_name?: string; - /** The label of the option value. */ - label?: string; - } & { - id?: number; - option_id?: number; - })[]; - /** The price of the variant as seen on the storefront. This price takes into account `sale_price` and any price adjustment rules that are applicable to this variant. */ - calculated_price?: number; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; -} -export interface operations { - /** Returns a list of **Products**. Optional filter parameters can be passed in. */ - getProducts: { - parameters: { - query: { - /** Filter items by name. */ - name?: unknown; - /** Filter items by sku. */ - sku?: unknown; - /** Filter items by upc. */ - upc?: unknown; - /** Filter items by price. */ - price?: unknown; - /** Filter items by weight. */ - weight?: unknown; - /** Filter items by condition. */ - condition?: unknown; - /** Filter items by brand_id. */ - brand_id?: unknown; - /** Filter items by `date_modified`. For example, `/v3/catalog/products?date_modified:min=2018-06-15` gets all products modified after `2018-06-15` */ - date_modified?: unknown; - /** Filter items by date_last_imported. For example `v3/catalog/products?date_last_imported:min=2018-06-15` */ - date_last_imported?: unknown; - /** Filter items by if visible on the storefront. */ - is_visible?: unknown; - /** Filter items by is_featured. `0` for true, `1` for false. */ - is_featured?: unknown; - /** Filter items by is_free_shipping. */ - is_free_shipping?: unknown; - /** Filter items by inventory_level. */ - inventory_level?: unknown; - /** Filter items by inventory_low. Values: 1, 0. */ - inventory_low?: unknown; - /** Filter items by out_of_stock. To enable the filter, pass `out_of_stock`=`1`. */ - out_of_stock?: unknown; - /** Filter items by total_sold. */ - total_sold?: unknown; - /** Filter items by type: `physical` or `digital`. */ - type?: unknown; - /** - * Filter items by categories. - * If a product is in more than one category, using this query will not return the product. Instead use `categories:in=12`. - */ - categories?: unknown; - /** Filter items by keywords found in the `name`, `description`, or `sku` fields, or in the brand name. */ - keyword?: unknown; - /** Set context used by the search algorithm to return results targeted towards the specified group. Use `merchant` to help merchants search their own catalog. Use `shopper` to return shopper-facing search results. */ - keyword_context?: unknown; - /** Filter items by status. */ - status?: unknown; - /** Sub-resources to include on a product, in a comma-separated list. If `options` or `modifiers` is used, results are limited to 10 per page. */ - include?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - /** Filter items by availability. Values are: available, disabled, preorder. */ - availability?: unknown; - /** - * This filter returns the product pricing with the *Price List* pricing instead. To use: - * `?price_list_id=1`. - * If there are variants use: - * `?price_list_id=1&include=variants` - */ - price_list_id?: unknown; - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Sort direction. Acceptable values are: `asc`, `desc`. */ - direction?: unknown; - /** Field name to sort by. Note: Since `id` increments when new products are added, you can use that field to sort by product create date. */ - sort?: unknown; - }; - }; - responses: { - 200: responses["ProductCollectionResponse"]; - }; - }; - /** - * Updates products in batches. At the time of writing, batches are limited to 10 products. - * - * **Required Fields** - * * `id` - product `id` is required for batch updates to products. - * - * **Read-Only Fields** - * - `id` - * - `date_created` - * - `date_modified` - * - `calculated_price` - * - `base_variant_id` - */ - updateProducts: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - body: { - products?: definitions["product_Put_Collection"]; - }; - }; - responses: { - 200: responses["ProductCollectionResponse"]; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** `Product` was in conflict with another product. This is caused by: duplicate unique values, such as name or SKU; a missing category, brand, or tax_class with which the product is being associated; or a conflicting bulk pricing rule. */ - 409: { - schema: ({ - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - })[]; - }; - 413: unknown; - /** `Product` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: ({ - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - })[]; - }; - }; - }; - /** - * Creates a *Product*. Only one product can be created at a time. - * - * **Required Fields:** - * - `name` - * - `type` - * - `weight` - * - `price` - * - * **Read-Only Fields** - * - `id` - * - `date_created` - * - `date_modified` - * - `calculated_price` - * - `base_variant_id` - * - * **Usage Notes** - * * `POST` requests to `/products` accepts a single `video` object; to send an array of video objects, see: `/products/{product_id}/videos`. - */ - createProduct: { - parameters: { - body: { - product: definitions["product_Post"]; - }; - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 200: responses["ProductResponse"]; - /** `Product` was in conflict with another product. This is the result of duplicate unique values, such as name or SKU; a missing or invalid `category_id`, `brand_id`, or `tax_class id`; or a conflicting `bulk_pricing_rule`. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** `Product` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** - * To delete *Product* objects, you must include a filter. This prevents inadvertently deleting all *Product* objects in a store. - * - * **Example**: - * To delete products with the id's of 1,2 and 3, use `DELETE /v3/catalog/products?id:in=1,2,3`. - */ - deleteProducts: { - parameters: { - query: { - /** Filter items by name. */ - name?: unknown; - /** Filter items by sku. */ - sku?: unknown; - /** Filter items by price. */ - price?: unknown; - /** Filter items by weight. */ - weight?: unknown; - /** Filter items by condition. */ - condition?: unknown; - /** Filter items by brand_id. */ - brand_id?: unknown; - /** Filter items by date_modified. For example `v3/catalog/products?date_modified:min=2018-06-15` */ - date_modified?: unknown; - /** Filter items by date_last_imported. For example `v3/catalog/products?date_last_imported:min=2018-06-15` */ - date_last_imported?: unknown; - /** Filter items by if visible on the storefront. */ - is_visible?: unknown; - /** Filter items by is_featured. */ - is_featured?: unknown; - /** Filter items by inventory_level. */ - inventory_level?: unknown; - /** Filter items by total_sold. */ - total_sold?: unknown; - /** Filter items by type: `physical` or `digital`. */ - type?: unknown; - /** - * Filter items by categories. - * If a product is in more than one category, using this query will not return the product. Instead use `categories:in=12`. - */ - categories?: unknown; - /** Filter items by keywords found in the `name`, `description`, or `sku` fields, or in the brand name. */ - keyword?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a single *Product*. Optional parameters can be passed in. */ - getProductById: { - parameters: { - query: { - /** Sub-resources to include on a product, in a comma-separated list. If `options` or `modifiers` is used, results are limited to 10 per page. */ - include?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["product_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Product*. - * - * **Read-Only Fields** - * - id - * - date_created - * - date_modified - * - calculated_price - * - base_variant_id - */ - updateProduct: { - parameters: { - body: { - product: definitions["product_Put"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: responses["ProductResponse"]; - /** Created */ - 201: { - schema: { - [key: string]: any; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** `Product` was in conflict with another product. This is caused by: duplicate unique values, such as name or SKU; a missing category, brand, or tax_class with which the product is being associated; or a conflicting bulk pricing rule. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** `Product` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Product*. */ - deleteProductById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of *Product Images*. Optional parameters can be passed in. */ - getProductImages: { - parameters: { - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productImage_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** There are not any images on this product. */ - 204: never; - /** The product ID does not exist. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a *Product Image*. - * - * **Required Fields** - * - `image_file`, or - * - `image_url` - * - * **Usage Notes** - * - `image_url` - `255` character limit - * - For file uploads, use the `multipart/form-data` media type - * - Only one image at a time can be created - * - Supported image file types are BMP, GIF, JPEG, PNG, WBMP, and XBM. - */ - createProductImage: { - parameters: { - body: { - productImage: { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** - * The local path to the original image file uploaded to BigCommerce. - * A `multipart/form-data` media type. - */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - } & { - /** Must be a fully qualified URL path, including protocol. Limit of 8MB per file. */ - image_url?: string; - /** Must be sent as a multipart/form-data field in the request body. */ - image_file?: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** - * The local path to the original image file uploaded to BigCommerce. - * - * A `multipart/form-data` media type. - */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - } & { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** - * The local path to the original image file uploaded to BigCommerce. Use image_url when creating a product. - * A `multipart/form-data` media type. - */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** - * Publically available URL. - * Use the image_url when creating a product. - */ - image_url?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The product ID does not exist. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Returns a single *Product Image*. Optional parameters can be passed in. */ - getProductImageById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productImage_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Product Image*. - * - * **Usage Notes** - * - `image_url` - `255` character limit - * - For file uploads, send a POST request using the `multipart/form-data` media type - */ - updateProductImage: { - parameters: { - body: { - productImage: { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** Flag for identifying whether the image is used as the product's thumbnail. */ - is_thumbnail?: boolean; - /** The order in which the image will be displayed on the product page. Higher integers give the image a lower priority. When updating, if the image is given a lower priority, all images with a `sort_order` the same as or greater than the image's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The description for the image. */ - description?: string; - } & { - /** The unique numeric ID of the image; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** The local path to the original image file uploaded to BigCommerce. Use image_url when creating a product. */ - image_file?: string; - /** The zoom URL for this image. By default, this is used as the zoom image on product pages when zoom images are enabled. */ - url_zoom?: string; - /** The standard URL for this image. By default, this is used for product-page images. */ - url_standard?: string; - /** The thumbnail URL for this image. By default, this is the image size used on the category page and in side panels. */ - url_thumbnail?: string; - /** The tiny URL for this image. By default, this is the image size used for thumbnails beneath the product image on a product page. */ - url_tiny?: string; - /** The date on which the product image was modified. */ - date_modified?: string; - /** - * Publically available URL. - * Use the image_url when creating a product. - */ - image_url?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Deletes a *Product Image*. */ - deleteProductImage: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of *Product Videos*. Optional parameters can be passed in. */ - getProductVideos: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productVideo_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - }; - }; - /** - * Creates a *Product Video*. - * - * **Required Fields** - * * video_id - Example: https://www.youtube.com/watch?v=`R12345677` - * - * **Read-Only Fields** - * * id - * - * Publicly accessible URLs are valid parameters. - * Videos must be loaded through YouTube at this time. - */ - createProductVideo: { - parameters: { - body: { - productVideo: { - /** The title for the video. If left blank, this will be filled in according to data on a host site. */ - title?: string; - /** The description for the video. If left blank, this will be filled in according to data on a host site. */ - description?: string; - /** The order in which the video will be displayed on the product page. Higher integers give the video a lower priority. When updating, if the video is given a lower priority, all videos with a `sort_order` the same as or greater than the video's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The video type (a short name of a host site). */ - type?: "youtube"; - } & { - /** The ID of the video on a host site. */ - video_id?: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** A product video model. */ - data?: { - /** The title for the video. If left blank, this will be filled in according to data on a host site. */ - title?: string; - /** The description for the video. If left blank, this will be filled in according to data on a host site. */ - description?: string; - /** The order in which the video will be displayed on the product page. Higher integers give the video a lower priority. When updating, if the video is given a lower priority, all videos with a `sort_order` the same as or greater than the video's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The video type (a short name of a host site). */ - type?: "youtube"; - } & { - /** The unique numeric ID of the product video; increments sequentially. */ - id?: number; - /** The ID of the video on a host site. */ - video_id?: string; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** Length of the video. This will be filled in according to data on a host site. */ - length?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Returns a single *Product Video*. Optional parameters can be passed in. */ - getProductVideoById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productVideo_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Product Video. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - */ - updateProductVideo: { - parameters: { - body: { - productVideo: { - /** The title for the video. If left blank, this will be filled in according to data on a host site. */ - title?: string; - /** The description for the video. If left blank, this will be filled in according to data on a host site. */ - description?: string; - /** The order in which the video will be displayed on the product page. Higher integers give the video a lower priority. When updating, if the video is given a lower priority, all videos with a `sort_order` the same as or greater than the video's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The video type (a short name of a host site). */ - type?: "youtube"; - } & { - /** The unique numeric ID of the product video; increments sequentially. */ - id?: number; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** A product video model. */ - data?: { - /** The title for the video. If left blank, this will be filled in according to data on a host site. */ - title?: string; - /** The description for the video. If left blank, this will be filled in according to data on a host site. */ - description?: string; - /** The order in which the video will be displayed on the product page. Higher integers give the video a lower priority. When updating, if the video is given a lower priority, all videos with a `sort_order` the same as or greater than the video's new `sort_order` value will have their `sort_order`s reordered. */ - sort_order?: number; - /** The video type (a short name of a host site). */ - type?: "youtube"; - } & { - /** The unique numeric ID of the product video; increments sequentially. */ - id?: number; - /** The ID of the video on a host site. */ - video_id?: string; - /** The unique numeric identifier for the product with which the image is associated. */ - product_id?: number; - /** Length of the video. This will be filled in according to data on a host site. */ - length?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Deletes a *Product Video*. */ - deleteProductVideo: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of product *Variants*. Optional parameters can be passed in. */ - getVariantsByProductId: { - parameters: { - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productVariant_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a *Product Variant*. - * - * **Required Fields** - * * sku - * * option_values - * - * **Read-Only Fields** - * * id - * - * Variants need to be created one at a time using this endpoint. To use a variant array and create products and variants in the same call use the [Create Products](/api-reference/catalog/catalog-api/products/createproduct) during the initial product creation. - */ - createVariant: { - parameters: { - body: { - Variant: definitions["productVariant_Post"]; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productVariant_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Returns a single product *Variant*. Optional parameters can be passed in. */ - getVariantById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productVariant_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Updates a product *Variant*. */ - updateVariant: { - parameters: { - body: { - Variant: definitions["productVariant_Put"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productVariant_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Deletes a product *Variant*. */ - deleteVariantById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of product variant *Metafields*. Optional parameters can be passed in. */ - getVariantMetafieldsByProductIdAndVariantId: { - parameters: { - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Filter based on a metafield's key. */ - key?: unknown; - /** Filter based on a metafield's namespace. */ - namespace?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - /** Determines whether the field is completely private to the app that owns the field (`app_only`), or visible to other API consumers (`read`), or completely open for reading and writing to other apps (`write`). Required for POST. */ - permission_set: "app_only" | "read" | "write" | "read_and_sf_access" | "write_and_sf_access"; - /** Namespace for the metafield, for organizational purposes. This is set set by the developer. Required for POST. */ - namespace: string; - /** The name of the field, for example: `location_id`, `color`. Required for POST. */ - key: string; - /** The value of the field, for example: `1`, `blue`. Required for POST. */ - value: string; - /** Description for the metafields. */ - description?: string; - /** The type of resource with which the metafield is associated. */ - resource_type?: "category" | "brand" | "product" | "variant"; - /** The ID for the resource with which the metafield is associated. */ - resource_id?: number; - /** Date and time of the metafield's creation. Read-Only. */ - created_at?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - updated_at?: string; - }[]; - meta?: definitions["categoriesTree_Resp"]; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a product variant *Metafield*. - * - * **Required Fields:** - * * permission_set - * * namespace - * * key - * * value - * - * **Read-Only Fields** - * * id - * - * **Note:** The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - createVariantMetafield: { - parameters: { - body: { - Metafield: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - /** Determines whether the field is completely private to the app that owns the field (`app_only`), or visible to other API consumers (`read`), or completely open for reading and writing to other apps (`write`). Required for POST. */ - permission_set: "app_only" | "read" | "write" | "read_and_sf_access" | "write_and_sf_access"; - /** Namespace for the metafield, for organizational purposes. This is set set by the developer. Required for POST. */ - namespace: string; - /** The name of the field, for example: `location_id`, `color`. Required for POST. */ - key: string; - /** The value of the field, for example: `1`, `blue`. Required for POST. */ - value: string; - /** Description for the metafields. */ - description?: string; - /** The type of resource with which the metafield is associated. */ - resource_type?: "category" | "brand" | "product" | "variant"; - /** The ID for the resource with which the metafield is associated. */ - resource_id?: number; - /** Date and time of the metafield's creation. Read-Only. */ - created_at?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - updated_at?: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Common Metafield properties. */ - data?: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - /** Determines whether the field is completely private to the app that owns the field (`app_only`), or visible to other API consumers (`read`), or completely open for reading and writing to other apps (`write`). Required for POST. */ - permission_set: "app_only" | "read" | "write" | "read_and_sf_access" | "write_and_sf_access"; - /** Namespace for the metafield, for organizational purposes. This is set set by the developer. Required for POST. */ - namespace: string; - /** The name of the field, for example: `location_id`, `color`. Required for POST. */ - key: string; - /** The value of the field, for example: `1`, `blue`. Required for POST. */ - value: string; - /** Description for the metafields. */ - description?: string; - /** The type of resource with which the metafield is associated. */ - resource_type?: "category" | "brand" | "product" | "variant"; - /** The ID for the resource with which the metafield is associated. */ - resource_id?: number; - /** Date and time of the metafield's creation. Read-Only. */ - created_at?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - updated_at?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `Metafield` was in conflict with another `Metafield`. This can be the result of duplicate unique-key combinations of the app's client id, namespace, key, resource_type, and resource_id. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Metafield` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single product variant *Metafield*. Optional parameters can be passed in. */ - getVariantMetafieldByProductIdAndVariantId: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a product variant *Metafield*. - * - * **Required Fields:** - * * none - * - * **Read-Only Fields** - * * id - * * These fields can only be modified by the app (API credentials) that created the metafield: - * * namespace - * * key - * * permission_set - * - * **Usage Notes** - * * Attempting to modify `namespace`, `key`, and `permission_set` fields using a client ID different from the one used to create those metafields will result in a 403 error message. - */ - updateVariantMetafield: { - parameters: { - body: { - Metafield: definitions["metafield_Put"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Deletes a product variant *Metafield*. */ - deleteVariantMetafieldById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** - * Creates a *Variant Image*. - * - * The image will show on the storefront when the value is selected. - * - * **Required Fields** - * - image_file: Form posts. Files larger than 1 MB are not accepted - * - image_url: Any publicly available URL - */ - createVariantImage: { - parameters: { - path: { - /** The ID of the `Product` to which the resource belongs. */ - product_id: unknown; - /** ID of the variant on a product, or on an associated Price List Record. */ - variant_id: unknown; - }; - body: { - body?: { - /** A public URL for a GIF, JPEG, or PNG image. Limit of 8MB per file. */ - image_url?: string; - }; - }; - }; - responses: { - /** `image_url` is returned for both `image_file` and `image_url`. */ - 200: { - schema: { - /** An object containing a publicly accessible image URL, or a form post that contains an image file. */ - data?: { - /** A public URL for a GIF, JPEG, or PNG image. Limit of 8MB per file. */ - image_url?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** Image was not valid. This is the result of a missing `image_file` field or of an incorrect file type. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** Returns for an `image_file` larger than 1 MB. */ - 500: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a list of product *Variant Options*. Optional parameters can be passed in. */ - getOptions: { - parameters: { - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productOption_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a *Variant Option*. - * - * **Required Fields** - * * display_name - * * type - * * option_values - * - * **Read-Only Fields** - * * id - * - * **Notes** - * - * * Only one variant option at a time can be created; individual variant options will contain an array of multiple values. - * * There are several examples listed below that create options, but the SKU’s are not updated and they are not a variant on the product. Variant SKUs must be created with a separate request. - * * Variant options will show on the storefront as an option that can be selected by the customer. A request like this could be used to add new choices to a variant that has already been created. - * * If more than one variant needs to be created use the [Create a Product](/api-reference/catalog/catalog-api/products/createproduct) endpoint. - */ - createOption: { - parameters: { - body: { - Option: { - /** The unique numerical ID of the option, increments sequentially. */ - id?: number; - /** The unique numerical ID of the product to which the option belongs. */ - product_id?: number; - /** The name of the option shown on the storefront. */ - display_name?: string; - /** The type of option, which determines how it will display on the storefront. Acceptable values: `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. For reference, the former v2 API values are: RB = radio_buttons, RT = rectangles, S = dropdown, P = product_list, PI = product_list_with_images, CS = swatch. */ - type?: "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - /** Order in which the option is displayed on the storefront. */ - sort_order?: number; - option_values?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - /** Publicly available image url */ - image_url?: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: responses["OptionResponse"]; - /** Option was in conflict with another option. This is the result of duplicate unique fields, such as `name`. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** Option was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Variant Option*. Optional parameters can be passed in. */ - getOptionById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productOption_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Variant Option*. - * - * **Read-Only Fields** - * * id - */ - updateOption: { - parameters: { - body: { - option: { - /** The unique numerical ID of the option, increments sequentially. */ - id?: number; - /** The unique numerical ID of the product to which the option belongs. */ - product_id?: number; - /** The name of the option shown on the storefront. */ - display_name?: string; - /** The type of option, which determines how it will display on the storefront. Acceptable values: `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. For reference, the former v2 API values are: RB = radio_buttons, RT = rectangles, S = dropdown, P = product_list, PI = product_list_with_images, CS = swatch. */ - type?: "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - /** Order in which the option is displayed on the storefront. */ - sort_order?: number; - option_values?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - /** Publicly available image url */ - image_url?: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - /** The unique numerical ID of the option, increments sequentially. */ - id?: number; - /** The unique numerical ID of the product to which the option belongs. */ - product_id?: number; - /** The name of the option shown on the storefront. */ - display_name?: string; - /** The type of option, which determines how it will display on the storefront. Acceptable values: `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. For reference, the former v2 API values are: RB = radio_buttons, RT = rectangles, S = dropdown, P = product_list, PI = product_list_with_images, CS = swatch. */ - type?: "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - /** Order in which the option is displayed on the storefront. */ - sort_order?: number; - option_values?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - /** Publicly available image url */ - image_url?: string; - } & { - /** The unique option name, auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `Option` was in conflict with another option. This is the result of duplicate unique fields, such as `name`. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Option` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Variant Option*. */ - deleteOptionById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of all *Variant Option Values*. Optional parameters can be passed in. */ - getOptionValues: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - }; - }; - /** - * Creates a *Variant Option Value*. - * - * **Required Fields** - * * label - * * sort_order - * - * **Read-Only Fields** - * * id - */ - createOptionValue: { - parameters: { - body: { - OptionValue: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `OptionValue` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Variant Option Value*. Optional parameters can be passed in. */ - getOptionValueById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Variant Option Value*. - * - * **Read-Only Fields** - * * id - */ - updateOptionValue: { - parameters: { - body: { - /** A BigCommerce `OptionValue` object. */ - OptionValue: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `OptionValue` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletea a *Variant Option Value*. */ - deleteOptionValueById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of all *Product Modifiers*. Optional parameters can be passed in. */ - getModifiers: { - parameters: { - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productModifier_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - }; - }; - /** - * Creates a *Product Modifier*. - * - * **Required Fields** - * * `required` - * * `display_name` - * * `type` - * - * **Read-Only Fields** - * * `id` - */ - createModifier: { - parameters: { - body: { - Modifier: { - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - option_values?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - } & { - /** The name of the option shown on the storefront. */ - display_name: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Product Modifier */ - data?: { - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - option_values?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - } & { - /** The unique numeric ID of the modifier; increments sequentially. */ - id?: number; - /** The unique numeric ID of the product to which the option belongs. */ - product_id?: number; - /** The unique option name. Auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - /** The name of the option shown on the storefront. */ - display_name?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `Modifier` was in conflict with another option. This is the result of duplicate unique fields, such as `name`. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Modifier` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Product Modifier*. Optional parameters can be passed in. */ - getModifierById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productModifier_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Updates a *Product Modifier*. */ - updateModifier: { - parameters: { - body: { - modifier: { - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - option_values?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Product Modifier */ - data?: { - /** BigCommerce API, which determines how it will display on the storefront. Acceptable values: `date`, `checkbox`, `file`, `text`, `multi_line_text`, `numbers_only_text`, `radio_buttons`, `rectangles`, `dropdown`, `product_list`, `product_list_with_images`, `swatch`. Required in a /POST. */ - type: "date" | "checkbox" | "file" | "text" | "multi_line_text" | "numbers_only_text" | "radio_buttons" | "rectangles" | "dropdown" | "product_list" | "product_list_with_images" | "swatch"; - /** Whether or not this modifer is required or not at checkout. Required in a /POST. */ - required: boolean; - /** The order the modifiers display on the product detail page. */ - sort_order?: number; - /** The values for option config can vary based on the Modifier created. */ - config?: { - /** (date, text, multi_line_text, numbers_only_text) The default value. Shown on a date option as an ISO-8601–formatted string, or on a text option as a string. */ - default_value?: string; - /** (checkbox) Flag for setting the checkbox to be checked by default. */ - checked_by_default?: boolean; - /** (checkbox) Label displayed for the checkbox option. */ - checkbox_label?: string; - /** (date) Flag to limit the dates allowed to be entered on a date option. */ - date_limited?: boolean; - /** (date) The type of limit that is allowed to be entered on a date option. */ - date_limit_mode?: "earliest" | "range" | "latest"; - /** (date) The earliest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_earliest_value?: string; - /** (date) The latest date allowed to be entered on the date option, as an ISO-8601 formatted string. */ - date_latest_value?: string; - /** (file) The kind of restriction on the file types that can be uploaded with a file upload option. Values: `specific` - restricts uploads to particular file types; `all` - allows all file types. */ - file_types_mode?: "specific" | "all"; - /** - * (file) The type of files allowed to be uploaded if the `file_type_option` is set to `specific`. Values: - * `images` - Allows upload of image MIME types (`bmp`, `gif`, `jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `jfi`, `png`, `wbmp`, `xbm`, `tiff`). `documents` - Allows upload of document MIME types (`txt`, `pdf`, `rtf`, `doc`, `docx`, `xls`, `xlsx`, `accdb`, `mdb`, `one`, `pps`, `ppsx`, `ppt`, `pptx`, `pub`, `odt`, `ods`, `odp`, `odg`, `odf`). - * `other` - Allows file types defined in the `file_types_other` array. - */ - file_types_supported?: string[]; - /** (file) A list of other file types allowed with the file upload option. */ - file_types_other?: string[]; - /** (file) The maximum size for a file that can be used with the file upload option. This will still be limited by the server. */ - file_max_size?: number; - /** (text, multi_line_text) Flag to validate the length of a text or multi-line text input. */ - text_characters_limited?: boolean; - /** (text, multi_line_text) The minimum length allowed for a text or multi-line text option. */ - text_min_length?: number; - /** (text, multi_line_text) The maximum length allowed for a text or multi line text option. */ - text_max_length?: number; - /** (multi_line_text) Flag to validate the maximum number of lines allowed on a multi-line text input. */ - text_lines_limited?: boolean; - /** (multi_line_text) The maximum number of lines allowed on a multi-line text input. */ - text_max_lines?: number; - /** (numbers_only_text) Flag to limit the value of a number option. */ - number_limited?: boolean; - /** (numbers_only_text) The type of limit on values entered for a number option. */ - number_limit_mode?: "lowest" | "highest" | "range"; - /** (numbers_only_text) The lowest allowed value for a number option if `number_limited` is true. */ - number_lowest_value?: number; - /** (numbers_only_text) The highest allowed value for a number option if `number_limited` is true. */ - number_highest_value?: number; - /** (numbers_only_text) Flag to limit the input on a number option to whole numbers only. */ - number_integers_only?: boolean; - /** (product_list, product_list_with_images) Flag for automatically adjusting inventory on a product included in the list. */ - product_list_adjusts_inventory?: boolean; - /** (product_list, product_list_with_images) Flag to add the optional product's price to the main product's price. */ - product_list_adjusts_pricing?: boolean; - /** (product_list, product_list_with_images) How to factor the optional product's weight and package dimensions into the shipping quote. Values: `none` - don't adjust; `weight` - use shipping weight only; `package` - use weight and dimensions. */ - product_list_shipping_calc?: "none" | "weight" | "package"; - }; - option_values?: (({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - })[]; - } & { - /** The unique numeric ID of the modifier; increments sequentially. */ - id?: number; - /** The unique numeric ID of the product to which the option belongs. */ - product_id?: number; - /** The unique option name. Auto-generated from the display name, a timestamp, and the product ID. */ - name?: string; - /** The name of the option shown on the storefront. */ - display_name?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `Modifier` was in conflict with another modifier or option. This is the result of duplicate unique fields, such as `name`. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Modifier` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Product Modifier*. */ - deleteModifierById: { - parameters: { - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of all product *Modifier Values*. Optional parameters can be passed in. */ - getModifierValues: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productModifierOptionValue_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - }; - }; - /** - * Creates a *Modifier Value*. - * - * **Required Fields** - * * label - * * sort_order - * - * **Read-Only Fields** - * * id - */ - createModifierValue: { - parameters: { - body: { - ModifierValue: { - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Part of Modifier Value Response */ - data?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `ModifierValue` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Modifier Value*. Optional parameters can be passed in. */ - getModifierValueById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productModifierOptionValue_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Modifier Value*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - */ - updateModifierValue: { - parameters: { - body: { - ModifierValue: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Part of Modifier Value Response */ - data?: ({ - /** The flag for preselecting a value as the default on the storefront. This field is not supported for swatch options/modifiers. */ - is_default?: boolean; - /** The text display identifying the value on the storefront. Required in a /POST. */ - label: string; - /** The order in which the value will be displayed on the product page. Required in a /POST. */ - sort_order: number; - /** Extra data describing the value, based on the type of option or modifier with which the value is associated. The `swatch` type option can accept an array of `colors`, with up to three hexidecimal color keys; or an `image_url`, which is a full image URL path including protocol. The `product list` type option requires a `product_id`. The `checkbox` type option requires a boolean flag, called `checked_value`, to determine which value is considered to be the checked state. */ - value_data?: { - [key: string]: any; - }; - } & { - adjusters?: { - /** Adjuster for Complex Rules. */ - price?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** The URL for an image displayed on the storefront when the modifier value is selected.Limit of 8MB per file. */ - image_url?: string; - purchasing_disabled?: { - /** Flag for whether the modifier value disables purchasing when selected on the storefront. This can be used for temporarily disabling a particular modifier value. */ - status?: boolean; - /** The message displayed on the storefront when the purchasing disabled status is `true`. */ - message?: string; - }; - }; - }) & { - /** The unique numeric ID of the value; increments sequentially. */ - id?: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `ModifierValue` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Modifier Value*. */ - deleteModifierValueById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** - * Creates a *Modifier Image*. - * - * The image will show on the storefront when the value is selected. - * - * **Required Fields** - * - image_file: Form posts are the only accepted upload option. - */ - createModifierImage: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - formData: { - image_file?: unknown; - }; - }; - responses: { - 200: { - schema: { - /** An object containing a publicly accessible image URL, or a form post that contains an image file. */ - data?: { - /** A public URL for a GIF, JPEG, or PNG image. Limit of 8MB per file. */ - image_url?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** Modifier image was not valid. This is the result of missing `image_file` fields, or of a non-URL value for the `image_file` field. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** - * Deletes a *Modifier Image*. - * - * Deletes the image that was set to show when the modifier value is selected. - */ - deleteModifierImage: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of all product *Complex Rules*. Optional parameters may be passed in. */ - getComplexRules: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["complexRule_Base"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - }; - }; - /** - * Creates a product *Complex Rule*. - * - * **Required Fields** - * - modifier_id - * - modifier_value_id - * - modifier_value_id - * - variant_id - * - * **Read-Only Fields** - * - complex_rule_id - * - conditions_id - * - rule_id - * - combination_id - * - id - */ - createComplexRule: { - parameters: { - body: { - ComplexRule: { - /** - * The unique numeric ID of the rule; increments sequentially. - * Read-Only - */ - id?: number; - /** The unique numeric ID of the product with which the rule is associated; increments sequentially. */ - product_id?: number; - /** The priority to give this rule when making adjustments to the product properties. */ - sort_order?: number; - /** Flag for determining whether the rule is to be used when adjusting a product's price, weight, image, or availabilty. */ - enabled?: boolean; - /** Flag for determining whether other rules should not be applied after this rule has been applied. */ - stop?: boolean; - /** Flag for determining whether the rule should disable purchasing of a product when the conditions are applied. */ - purchasing_disabled?: boolean; - /** Message displayed on the storefront when a rule disables the purchasing of a product. */ - purchasing_disabled_message?: string; - /** Flag for determining whether the rule should hide purchasing of a product when the conditions are applied. */ - purchasing_hidden?: boolean; - /** The URL for an image displayed on the storefront when the conditions are applied. Limit of 8MB per file. */ - image_url?: string; - /** Adjuster for Complex Rules. */ - price_adjuster?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight_adjuster?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - conditions?: { - /** The unique numeric ID of the rule condition; increments sequentially. Read-Only */ - id?: number; - /** - * The unique numeric ID of the rule with which the condition is associated. - * Read-Only - */ - rule_id?: number; - /** - * The unique numeric ID of the modifier with which the rule condition is associated. - * Required in /POST. - */ - modifier_id: number; - /** - * The unique numeric ID of the modifier value with which the rule condition is associated. - * Required in /POST. - */ - modifier_value_id: number; - /** - * The unique numeric ID of the variant with which the rule condition is associated. - * Required in /POST. - */ - variant_id: number; - /** (READ-ONLY:) The unique numeric ID of the SKU (v2 API), or Combination, with which the rule condition is associated. This is to maintain cross-compatibility between v2 and v3. */ - combination_id?: number; - }[]; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: responses["ComplexRuleResponse"]; - /** The `ComplexRule` was in conflict with another `ComplexRule`. This is the result of duplicate conditions. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `ComplexRule` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Complex Rule*. Optional parameters can be passed in. */ - getComplexRuleById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: responses["ComplexRuleResponse"]; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Complex Rule*. - * - * **Required Fields**: - * - none - * - * **Read-Only Fields**: - * - complex_rule_id - * - conditions_id - * - rule_id - * - combination_id - * - id - */ - updateComplexRule: { - parameters: { - body: { - ComplexRule: { - /** - * The unique numeric ID of the rule; increments sequentially. - * Read-Only - */ - id?: number; - /** The unique numeric ID of the product with which the rule is associated; increments sequentially. */ - product_id?: number; - /** The priority to give this rule when making adjustments to the product properties. */ - sort_order?: number; - /** Flag for determining whether the rule is to be used when adjusting a product's price, weight, image, or availabilty. */ - enabled?: boolean; - /** Flag for determining whether other rules should not be applied after this rule has been applied. */ - stop?: boolean; - /** Flag for determining whether the rule should disable purchasing of a product when the conditions are applied. */ - purchasing_disabled?: boolean; - /** Message displayed on the storefront when a rule disables the purchasing of a product. */ - purchasing_disabled_message?: string; - /** Flag for determining whether the rule should hide purchasing of a product when the conditions are applied. */ - purchasing_hidden?: boolean; - /** The URL for an image displayed on the storefront when the conditions are applied. Limit of 8MB per file. */ - image_url?: string; - /** Adjuster for Complex Rules. */ - price_adjuster?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - /** Adjuster for Complex Rules. */ - weight_adjuster?: { - /** The type of adjuster for either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster?: "relative" | "percentage"; - /** The numeric amount by which the adjuster will change either the price or the weight of the variant, when the modifier value is selected on the storefront. */ - adjuster_value?: number; - }; - conditions?: { - /** The unique numeric ID of the rule condition; increments sequentially. Read-Only */ - id?: number; - /** - * The unique numeric ID of the rule with which the condition is associated. - * Read-Only - */ - rule_id?: number; - /** - * The unique numeric ID of the modifier with which the rule condition is associated. - * Required in /POST. - */ - modifier_id: number; - /** - * The unique numeric ID of the modifier value with which the rule condition is associated. - * Required in /POST. - */ - modifier_value_id: number; - /** - * The unique numeric ID of the variant with which the rule condition is associated. - * Required in /POST. - */ - variant_id: number; - /** (READ-ONLY:) The unique numeric ID of the SKU (v2 API), or Combination, with which the rule condition is associated. This is to maintain cross-compatibility between v2 and v3. */ - combination_id?: number; - }[]; - }; - }; - }; - responses: { - 200: responses["ComplexRuleResponse"]; - /** The `ComplexRule` was in conflict with another `ComplexRule`. This is the result of duplicate conditions. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `ComplexRule` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a product *Complex Rule*. */ - deleteComplexRuleById: { - parameters: { - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of product *Custom Fields*. Optional parameters can be passed in. */ - getCustomFields: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - }; - }; - /** - * Creates a *Custom Field*. - * - * **Required Fields:** - * - name - * - value - * - * **Read-Only:** - * - id - */ - createCustomField: { - parameters: { - body: { - CustomField: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Gets custom fields associated with a product. These allow you to specify additional information that will appear on the product's page, such as a book's ISBN or a DVD's release date. */ - data?: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The parent resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** The `CustomField` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Custom Field*. Optional parameters can be passed in. */ - getCustomFieldById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["productCustomField_Base"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Custom Field*. - * - * **Required Fields** - * - none - * - * **Read-Only** - * - id - */ - updateCustomField: { - parameters: { - body: { - CustomField: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Gets custom fields associated with a product. These allow you to specify additional information that will appear on the product's page, such as a book's ISBN or a DVD's release date. */ - data?: { - /** - * The unique numeric ID of the custom field; increments sequentially. - * Read-Only - */ - id?: number; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - name: string; - /** The name of the field, shown on the storefront, orders, etc. Required for /POST */ - value: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** The `CustomField` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a product *Custom Field*. */ - deleteCustomFieldById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Returns a list of *Bulk Pricing Rules*. Optional parameters can be passed in. */ - getBulkPricingRules: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["bulkPricingRule_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** The parent resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a *Bulk Pricing Rule*. - * - * **Required Fields** - * - quantity_min - * - quantity_max - * - type - * - amount - * - * **Read-Only Fields** - * - id - */ - createBulkPricingRule: { - parameters: { - body: { - BulkPricingRule: definitions["bulkPricingRule_Full"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["bulkPricingRule_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The parent resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** The `BulkPricingRule` was in conflict with another bulk pricing rule. This is the result of quantity range overlapping with existing bulk pricing rules. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `BulkPricingRule` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Bulk Pricing Rule*. Optional parameters can be passed in. */ - getBulkPricingRuleById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["bulkPricingRule_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource or parent resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Bulk Pricing Rule*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * - id - */ - updateBulkPricingRule: { - parameters: { - body: { - BulkPricingRule: definitions["bulkPricingRule_Full"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Common BulkPricingRule properties */ - data?: { - /** Unique ID of the *Bulk Pricing Rule*. Read-Only. */ - id?: number; - /** - * The minimum inclusive quantity of a product to satisfy this rule. Must be greater than or equal to zero. - * Required in /POST. - */ - quantity_min: number; - /** - * The maximum inclusive quantity of a product to satisfy this rule. Must be greater than the `quantity_min` value – unless this field has a value of 0 (zero), in which case there will be no maximum bound for this rule. - * Required in /POST. - */ - quantity_max: number; - /** - * The type of adjustment that is made. Values: `price` - the adjustment amount per product; `percent` - the adjustment as a percentage of the original price; `fixed` - the adjusted absolute price of the product. - * Required in /POST. - */ - type: "price" | "percent" | "fixed"; - /** - * The discount can be a fixed dollar amount or a percentage. For a fixed dollar amount enter it as an integer and the response will return as an integer. For percentage enter the amount as the percentage divided by 100 using string format. For example 10% percent would be “.10”. The response will return as an integer. - * Required in /POST. - */ - amount: number; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource or parent resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** The `BulkPricingRule` was in conflict with another bulk pricing rule. This is the result of quantity range overlapping with existing bulk pricing rules. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `BulkPricingRule` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Bulk Pricing Rule*. */ - deleteBulkPricingRuleById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - /** The resource or parent resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Returns a list of *Product Metafields*. Optional parameters can be passed in. */ - getProductMetafieldsByProductId: { - parameters: { - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Filter based on a metafield's key. */ - key?: unknown; - /** Filter based on a metafield's namespace. */ - namespace?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a *Product Metafield*. - * - * **Required Fields:** - * * permission_set - * * namespace - * * key - * * value - * - * **Read-Only Fields** - * * id - * - * **Note:** The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - createProductMetafield: { - parameters: { - body: { - Metafield: definitions["metafield_Post"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `Metafield` was in conflict with another `Metafield`. This can be the result of duplicate unique key combinations of the app's client id, namespace, key, resource_type, and resource_id. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Metafield` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Product Metafield*. Optional parameters can be passed in. */ - getProductMetafieldByProductId: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Product Metafield*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - * * These fields can only be modified by the app (API credentials) that created the metafield: - * * namespace - * * key - * * permission_set - * - * **Usage Notes** - * * Attempting to modify `namespace`, `key`, and `permission_set` fields using a client ID different from the one used to create those metafields will result in a 403 error message. - */ - updateProductMetafield: { - parameters: { - body: { - Metafield: definitions["metafield_Put"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Common Metafield properties. */ - data?: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - /** Determines whether the field is completely private to the app that owns the field (`app_only`), or visible to other API consumers (`read`), or completely open for reading and writing to other apps (`write`). Required for POST. */ - permission_set: "app_only" | "read" | "write" | "read_and_sf_access" | "write_and_sf_access"; - /** Namespace for the metafield, for organizational purposes. This is set set by the developer. Required for POST. */ - namespace: string; - /** The name of the field, for example: `location_id`, `color`. Required for POST. */ - key: string; - /** The value of the field, for example: `1`, `blue`. Required for POST. */ - value: string; - /** Description for the metafields. */ - description?: string; - /** The type of resource with which the metafield is associated. */ - resource_type?: "category" | "brand" | "product" | "variant"; - /** The ID for the resource with which the metafield is associated. */ - resource_id?: number; - /** Date and time of the metafield's creation. Read-Only. */ - created_at?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - updated_at?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Deletes a *Product Metafield*. */ - deleteProductMetafieldById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of all *Product Reviews*. Optional parameters can be passed in. */ - getProductReviews: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: ({ - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - } & { - /** The unique numeric ID of the product review; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the review is associated. */ - product_id?: number; - /** Date the product review was created. */ - date_created?: string; - /** Date the product review was modified. */ - date_modified?: string; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** There are no reviews on this product. */ - 204: never; - /** The product ID does not exist. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a *Product Review*. - * - * **Required Fields** - * - title - * - date_reviewed - * - * **Read-Only Fields** - * * id - */ - createProductReview: { - parameters: { - body: { - productReview: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** A product review model. */ - data?: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - } & { - /** The unique numeric ID of the product review; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the review is associated. */ - product_id?: number; - /** Date the product review was created. */ - date_created?: string; - /** Date the product review was modified. */ - date_modified?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The product ID does not exist. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Returns a single *Product Review*. Optional parameters maybe passed in. */ - getProductReviewById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** A product review model. */ - data?: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - } & { - /** The unique numeric ID of the product review; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the review is associated. */ - product_id?: number; - /** Date the product review was created. */ - date_created?: string; - /** Date the product review was modified. */ - date_modified?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Product Review*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - */ - updateProductReview: { - parameters: { - body: { - /** A BigCommerce `ProductReview` object. */ - productReview: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** A product review model. */ - data?: { - /** - * The title for the product review. - * Required in /POST. - */ - title: string; - /** The text for the product review. */ - text?: string; - /** The status of the product review. Must be one of `approved`, `disapproved` or `pending`. */ - status?: string; - /** The rating of the product review. Must be one of 0, 1, 2, 3, 4, 5. */ - rating?: number; - /** The email of the reviewer. Must be a valid email, or an empty string. */ - email?: string; - /** The name of the reviewer. */ - name?: string; - /** Date the product was reviewed. Required in /POST. */ - date_reviewed: string; - } & { - /** The unique numeric ID of the product review; increments sequentially. */ - id?: number; - /** The unique numeric identifier for the product with which the review is associated. */ - product_id?: number; - /** Date the product review was created. */ - date_created?: string; - /** Date the product review was modified. */ - date_modified?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Deletes a *Product Review*. */ - deleteProductReview: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of *Categories*. Optional filter parameters can be passed in. */ - getCategories: { - parameters: { - query: { - /** Filter items by name. */ - name?: unknown; - /** Filter items by parent_id. If the category is a child or sub category it can be filtered with the parent_id. */ - parent_id?: unknown; - /** Filter items by page_title. */ - page_title?: unknown; - /** Filter items by keywords. eg. new, towel, bath */ - keyword?: unknown; - /** Filter items by if visible on the storefront. */ - is_visible?: unknown; - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: responses["CategoryCollectionResponse"]; - }; - }; - /** - * Creates a *Category*. - * - * **Required Fields**: - * - parent_id: - * - To create a child category, set the parent_id to the parent category. - * - To create a top level category, set the parent_id to 0. - * - name - * - * **Read-Only Fields**: - * - id - */ - createCategory: { - parameters: { - body: { - category: { - /** - * Unique ID of the *Category*. Increments sequentially. - * Read-Only. - */ - id?: number; - /** - * The unique numeric ID of the category's parent. This field controls where the category sits in the tree of categories that organize the catalog. - * Required in a POST if creating a child category. - */ - parent_id: number; - /** - * The name displayed for the category. Name is unique with respect to the category's siblings. - * Required in a POST. - */ - name: string; - /** The product description, which can include HTML formatting. */ - description?: string; - /** Number of views the category has on the storefront. */ - views?: number; - /** Priority this category will be given when included in the menu and category pages. The lower the number, the closer to the top of the results the category will be. */ - sort_order?: number; - /** Custom title for the category page. If not defined, the category name will be used as the meta title. */ - page_title?: string; - /** A comma-separated list of keywords that can be used to locate the category when searching the store. */ - search_keywords?: string; - /** Custom meta keywords for the category page. If not defined, the store's default keywords will be used. Must post as an array like: ["awesome","sauce"]. */ - meta_keywords?: string[]; - /** Custom meta description for the category page. If not defined, the store's default meta description will be used. */ - meta_description?: string; - /** A valid layout file. (Please refer to [this article](https://support.bigcommerce.com/articles/Public/Creating-Custom-Template-Files/) on creating category files.) This field is writable only for stores with a Blueprint theme applied. */ - layout_file?: string; - /** Flag to determine whether the product should be displayed to customers browsing the store. If `true`, the category will be displayed. If `false`, the category will be hidden from view. */ - is_visible?: boolean; - /** Determines how the products are sorted on category page load. */ - default_product_sort?: "use_store_settings" | "featured" | "newest" | "best_selling" | "alpha_asc" | "alpha_desc" | "avg_customer_review" | "price_asc" | "price_desc"; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/categories/{categoryId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the category on the storefront. */ - custom_url?: { - /** Category URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: responses["CategoryResponse"]; - /** The `Category` was in conflict with another category. This is the result of duplicate unique values, such as `name` or `custom_url`. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Category` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** - * By default, it deletes all *Category* objects. A filter should be added to avoid deleting all *Category* objects in a store. - * - * Sending a `DELETE` to this endpoint will result in a `422` error. Move products to a new category by sending a `PUT` to the `/catalog/products/{product_id}` endpoint before deleting a category. - */ - deleteCategories: { - parameters: { - query: { - /** Filter items by name. */ - name?: unknown; - /** Filter items by parent_id. If the category is a child or sub category it can be filtered with the parent_id. */ - parent_id?: unknown; - /** Filter items by page_title. */ - page_title?: unknown; - /** Filter items by keywords. eg. new, towel, bath */ - keyword?: unknown; - /** Filter items by if visible on the storefront. */ - is_visible?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a single *Category*. Optional parameters can be passed in. */ - getCategoryById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["category_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Category*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * - id - */ - updateCategory: { - parameters: { - body: { - category: { - /** - * Unique ID of the *Category*. Increments sequentially. - * Read-Only. - */ - id?: number; - /** - * The unique numeric ID of the category's parent. This field controls where the category sits in the tree of categories that organize the catalog. - * Required in a POST if creating a child category. - */ - parent_id: number; - /** - * The name displayed for the category. Name is unique with respect to the category's siblings. - * Required in a POST. - */ - name: string; - /** The product description, which can include HTML formatting. */ - description?: string; - /** Number of views the category has on the storefront. */ - views?: number; - /** Priority this category will be given when included in the menu and category pages. The lower the number, the closer to the top of the results the category will be. */ - sort_order?: number; - /** Custom title for the category page. If not defined, the category name will be used as the meta title. */ - page_title?: string; - /** A comma-separated list of keywords that can be used to locate the category when searching the store. */ - search_keywords?: string; - /** Custom meta keywords for the category page. If not defined, the store's default keywords will be used. Must post as an array like: ["awesome","sauce"]. */ - meta_keywords?: string[]; - /** Custom meta description for the category page. If not defined, the store's default meta description will be used. */ - meta_description?: string; - /** A valid layout file. (Please refer to [this article](https://support.bigcommerce.com/articles/Public/Creating-Custom-Template-Files/) on creating category files.) This field is writable only for stores with a Blueprint theme applied. */ - layout_file?: string; - /** Flag to determine whether the product should be displayed to customers browsing the store. If `true`, the category will be displayed. If `false`, the category will be hidden from view. */ - is_visible?: boolean; - /** Determines how the products are sorted on category page load. */ - default_product_sort?: "use_store_settings" | "featured" | "newest" | "best_selling" | "alpha_asc" | "alpha_desc" | "avg_customer_review" | "price_asc" | "price_desc"; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/categories/{categoryId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the category on the storefront. */ - custom_url?: { - /** Category URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Common Category object properties. */ - data?: { - /** - * Unique ID of the *Category*. Increments sequentially. - * Read-Only. - */ - id?: number; - /** - * The unique numeric ID of the category's parent. This field controls where the category sits in the tree of categories that organize the catalog. - * Required in a POST if creating a child category. - */ - parent_id: number; - /** - * The name displayed for the category. Name is unique with respect to the category's siblings. - * Required in a POST. - */ - name: string; - /** The product description, which can include HTML formatting. */ - description?: string; - /** Number of views the category has on the storefront. */ - views?: number; - /** Priority this category will be given when included in the menu and category pages. The lower the number, the closer to the top of the results the category will be. */ - sort_order?: number; - /** Custom title for the category page. If not defined, the category name will be used as the meta title. */ - page_title?: string; - /** A comma-separated list of keywords that can be used to locate the category when searching the store. */ - search_keywords?: string; - /** Custom meta keywords for the category page. If not defined, the store's default keywords will be used. Must post as an array like: ["awesome","sauce"]. */ - meta_keywords?: string[]; - /** Custom meta description for the category page. If not defined, the store's default meta description will be used. */ - meta_description?: string; - /** A valid layout file. (Please refer to [this article](https://support.bigcommerce.com/articles/Public/Creating-Custom-Template-Files/) on creating category files.) This field is writable only for stores with a Blueprint theme applied. */ - layout_file?: string; - /** Flag to determine whether the product should be displayed to customers browsing the store. If `true`, the category will be displayed. If `false`, the category will be hidden from view. */ - is_visible?: boolean; - /** Determines how the products are sorted on category page load. */ - default_product_sort?: "use_store_settings" | "featured" | "newest" | "best_selling" | "alpha_asc" | "alpha_desc" | "avg_customer_review" | "price_asc" | "price_desc"; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/categories/{categoryId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the category on the storefront. */ - custom_url?: { - /** Category URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** The `Category` was in conflict with another category. This is the result of duplicate unique values, such as `name` or `custom_url`. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Category` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Category*. */ - deleteCategoryById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of *Metafields* on a *Category*. Optional filter parameters can be passed in. */ - getCategoryMetafieldsByCategoryId: { - parameters: { - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Filter based on a metafield's key. */ - key?: unknown; - /** Filter based on a metafield's namespace. */ - namespace?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a *Category Metafield*. - * - * **Required Fields:** - * - permission_set - * - namespace - * - key - * - value - * - * **Read-Only Fields** - * - id - * - * **Note:** The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - createCategoryMetafield: { - parameters: { - body: { - Metafield: definitions["metafield_Post"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Common Metafield properties. */ - data?: { - /** Unique ID of the *Metafield*. Read-Only. */ - id?: number; - /** Determines whether the field is completely private to the app that owns the field (`app_only`), or visible to other API consumers (`read`), or completely open for reading and writing to other apps (`write`). Required for POST. */ - permission_set: "app_only" | "read" | "write" | "read_and_sf_access" | "write_and_sf_access"; - /** Namespace for the metafield, for organizational purposes. This is set set by the developer. Required for POST. */ - namespace: string; - /** The name of the field, for example: `location_id`, `color`. Required for POST. */ - key: string; - /** The value of the field, for example: `1`, `blue`. Required for POST. */ - value: string; - /** Description for the metafields. */ - description?: string; - /** The type of resource with which the metafield is associated. */ - resource_type?: "category" | "brand" | "product" | "variant"; - /** The ID for the resource with which the metafield is associated. */ - resource_id?: number; - /** Date and time of the metafield's creation. Read-Only. */ - created_at?: string; - /** Date and time when the metafield was last updated. Read-Only. */ - updated_at?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `Metafield` was in conflict with another `Metafield`. This can be the result of duplicate, unique key combinations of the app's client id, namespace, key, resource_type, and resource_id. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Metafield` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a single *Category Metafield*. Optional parameters can be passed in. */ - getCategoryMetafieldByCategoryId: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Base"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Category Metafield*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - * * These fields can only be modified by the app (API credentials) that created the metafield: - * * namespace - * * key - * * permission_set - * - * **Usage Notes** - * * Attempting to modify `namespace`, `key`, and `permission_set` fields using a client ID different from the one used to create those metafields will result in a 403 error message. - */ - updateCategoryMetafield: { - parameters: { - body: { - Metafield: definitions["metafield_Put"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Deletes a *Category Metafield*. */ - deleteCategoryMetafieldById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** - * Create a *Category Image*. - * - * **Required Fields** - * - image_file: Form posts are the only accepted upload option. - * - * Only one image at a time can be created. - * Limit image size to 1MB. - * To update a *Category Image*, use the [PUT Categories](/api-reference/catalog/catalog-api/category/updatecategory) and an `image_url`. - */ - createCategoryImage: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - formData: { - image_file?: unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - image_url?: string; - }; - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** Image was not valid. This is the result of a missing `image_file` field or an incorrect file type. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Cateogory Image*. */ - deleteCategoryImage: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns the categories tree, a nested lineage of the categories with parent->child relationship. The Category objects returned are simplified versions of the category objects returned in the rest of this API. */ - getCategoryTree: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: definitions["categoriesTree_Resp"]; - }; - }; - }; - /** Returns a list of *Brands*. Optional filter parameters can be passed in. */ - getBrands: { - parameters: { - query: { - /** Filter items by name. */ - name?: unknown; - /** Filter items by page_title. */ - page_title?: unknown; - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["brand_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - }; - }; - /** - * Creates a *Brand*. - * - * **Required Fields** - * - name - * - * **Read-Only Fields** - * - id - */ - createBrand: { - parameters: { - body: { - Brand: { - /** Unique ID of the *Brand*. Read-Only. */ - id?: number; - /** - * The name of the brand. Must be unique. - * Required in POST. - */ - name: string; - /** The title shown in the browser while viewing the brand. */ - page_title?: string; - /** Comma-separated list of meta keywords to include in the HTML. */ - meta_keywords?: string[]; - /** A meta description to include. */ - meta_description?: string; - /** A comma-separated list of keywords that can be used to locate this brand. */ - search_keywords?: string; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/brands/{brandId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the brand on the storefront. */ - custom_url?: { - /** Brand URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Common Brand properties. */ - data?: { - /** Unique ID of the *Brand*. Read-Only. */ - id?: number; - /** - * The name of the brand. Must be unique. - * Required in POST. - */ - name: string; - /** The title shown in the browser while viewing the brand. */ - page_title?: string; - /** Comma-separated list of meta keywords to include in the HTML. */ - meta_keywords?: string[]; - /** A meta description to include. */ - meta_description?: string; - /** A comma-separated list of keywords that can be used to locate this brand. */ - search_keywords?: string; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/brands/{brandId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the brand on the storefront. */ - custom_url?: { - /** Brand URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** Brand was in conflict with another brand. This is the result of duplicate unique fields such as name. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** Brand was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** By default, it deletes all *Brand* objects. A filter should be added to avoid deleting all *Brand* objects in a store. */ - deleteBrands: { - parameters: { - query: { - /** Filter items by name. */ - name?: unknown; - /** Filter items by page_title. */ - page_title?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a single *Brand*. Optional filter parameters can be passed in. */ - getBrandById: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["brand_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Brand*. - * - * **Required Fields** - * - None - * - * **Read-Only Fields** - * - id - * - * To update a *Brand Image*, send a request with an `image_url`. - */ - updateBrand: { - parameters: { - body: { - brand: { - /** Unique ID of the *Brand*. Read-Only. */ - id?: number; - /** - * The name of the brand. Must be unique. - * Required in POST. - */ - name: string; - /** The title shown in the browser while viewing the brand. */ - page_title?: string; - /** Comma-separated list of meta keywords to include in the HTML. */ - meta_keywords?: string[]; - /** A meta description to include. */ - meta_description?: string; - /** A comma-separated list of keywords that can be used to locate this brand. */ - search_keywords?: string; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/brands/{brandId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the brand on the storefront. */ - custom_url?: { - /** Brand URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }; - }; - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 200: { - schema: { - /** Common Brand properties. */ - data?: { - /** Unique ID of the *Brand*. Read-Only. */ - id?: number; - /** - * The name of the brand. Must be unique. - * Required in POST. - */ - name: string; - /** The title shown in the browser while viewing the brand. */ - page_title?: string; - /** Comma-separated list of meta keywords to include in the HTML. */ - meta_keywords?: string[]; - /** A meta description to include. */ - meta_description?: string; - /** A comma-separated list of keywords that can be used to locate this brand. */ - search_keywords?: string; - /** Image URL used for this category on the storefront. Images can be uploaded via form file post to `/brands/{brandId}/image`, or by providing a publicly accessible URL in this field. */ - image_url?: string; - /** The custom URL for the brand on the storefront. */ - custom_url?: { - /** Brand URL on the storefront. */ - url?: string; - /** Returns `true` if the URL has been changed from its default state (the auto-assigned URL that BigCommerce provides). */ - is_customized?: boolean; - }; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** The `Brand` was in conflict with another product. This is the result of duplicate unique values, such as `name`. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Brand` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Brand*. */ - deleteBrandById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of *Brand Metafields*. Optional filter parameters can be passed in. */ - getBrandMetafieldsByBrandId: { - parameters: { - query: { - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Filter based on a metafield's key. */ - key?: unknown; - /** Filter based on a metafield's namespace. */ - namespace?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"][]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Creates a *Brand Metafield*. - * - * **Required Fields** - * - permission_set - * - namespace - * - key - * - value - * - * **Read-Only Fields** - * - id - * - * **Note:** The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - createBrandMetafield: { - parameters: { - body: { - Metafield: definitions["metafield_Post"]; - }; - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 200: { - schema: { - /** Common Metafield properties. */ - data?: { - [key: string]: any; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The `Metafield` was in conflict with another `Metafield`. This can be the result of duplicate unique key combination of the app's client id, namespace, key, resource_type, and resource_id. */ - 409: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - /** The `Metafield` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Returns a *Brand Metafield*. Optional filter parameters can be passed in. */ - getBrandMetafieldByBrandId: { - parameters: { - query: { - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** - * Updates a *Brand Metafield*. - * - * **Required Fields** - * * none - * - * **Read-Only Fields** - * * id - * * These fields can only be modified by the app (API credentials) that created the metafield: - * * namespace - * * key - * * permission_set - * - * **Usage Notes** - * * Attempting to modify `namespace`, `key`, and `permission_set` fields using a client ID different from the one used to create those metafields will result in a 403 error message. - * * The max number of metafields allowed on each product, category, variant, or brand is fifty. For more information, see [Platform Limits](https://support.bigcommerce.com/s/article/Platform-Limits) in the Help Center. - */ - updateBrandMetafield: { - parameters: { - body: { - Metafield: definitions["metafield_Put"]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: definitions["metafield_Full"]; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Deletes a *Brand Metafield*. */ - deleteBrandMetafieldById: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** - * Creates a *Brand Image*. - * - * **Required Fields** - * - image_file: Form posts are the only accepted upload option. - * - * **Read-Only Fields** - * - id - * - * Only one image at a time can be created. To update a *Brand Image*, use the [PUT Brands](/api-reference/catalog/catalog-api/brands/updatebrand) and an `image_url`. - */ - createBrandImage: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - formData: { - image_file?: unknown; - }; - }; - responses: { - 200: { - schema: { - data?: { - image_url?: string; - }; - meta?: { - [key: string]: any; - }; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - /** Image was not valid. This is the result of a missing `image_file` field, or of an incorrect file type. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - }; - }; - }; - }; - /** Deletes a *Brand Image*. */ - deleteBrandImage: { - parameters: { - header: { - "Content-Type": unknown; - Accept: unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of all variants in your catalog. Optional parameters can be passed in. */ - getVariants: { - parameters: { - query: { - /** Filter items by id. */ - id?: unknown; - /** Filter items by sku. */ - sku?: unknown; - /** Specifies the page number in a limited (paginated) list of products. */ - page?: unknown; - /** Controls the number of items per page in a limited (paginated) list of products. */ - limit?: unknown; - /** Fields to include, in a comma-separated list. The ID and the specified fields will be returned. */ - include_fields?: unknown; - /** Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded. */ - exclude_fields?: unknown; - /** - * A comma-separated list of ids of Products whose prices were requested. For example: - * `?product_id=:id` - * `?product_id:in=77,80,81` - */ - product_id?: unknown; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: ({ - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - } & { - id?: number; - product_id?: number; - sku?: string; - /** Read-only reference to v2 API's SKU ID. Null if it is a base variant. */ - sku_id?: number; - /** Array of option and option values IDs that make up this variant. Will be empty if the variant is the product's base variant. */ - option_values?: ({ - /** The name of the option. */ - option_display_name?: string; - /** The label of the option value. */ - label?: string; - } & { - id?: number; - option_id?: number; - })[]; - /** The price of the variant as seen on the storefront. This price takes into account `sale_price` and any price adjustment rules that are applicable to this variant. */ - calculated_price?: number; - })[]; - meta?: definitions["metaCollection_Full"]; - }; - }; - /** The resource was not found. */ - 404: { - schema: { - /** 404 HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - }; - }; - }; - /** Creates or updates a batch of `Variant` objects. At the time of writing, the current limit is `50` variants. This limit is subject to change. */ - updateVariantsBatch: { - parameters: { - body: { - body: ({ - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - } & { - id?: number; - })[]; - }; - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - data?: ({ - /** The cost price of the variant. Not affected by Price List prices. */ - cost_price?: number; - /** This variant's base price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is `null`, the product's default price (set in the Product resource's `price` field) will be used as the base price. */ - price?: number; - /** This variant's sale price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's sale price (set in the Product resource's `price` field) will be used as the sale price. */ - sale_price?: number; - /** This variant's retail price on the storefront. If a Price List ID is used, the Price List value will be used. If a Price List ID is not used, and this value is null, the product's retail price (set in the Product resource's `price` field) will be used as the retail price. */ - retail_price?: number; - /** This variant's base weight on the storefront. If this value is null, the product's default weight (set in the Product resource's weight field) will be used as the base weight. */ - weight?: number; - /** Width of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default width (set in the Product resource's `width` field) will be used as the base width. */ - width?: number; - /** Height of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default height (set in the Product resource's `height` field) will be used as the base height. */ - height?: number; - /** Depth of the variant, which can be used when calculating shipping costs. If this value is `null`, the product's default depth (set in the Product resource's `depth` field) will be used as the base depth. */ - depth?: number; - /** Flag used to indicate whether the variant has free shipping. If `true`, the shipping cost for the variant will be zero. */ - is_free_shipping?: boolean; - /** A fixed shipping cost for the variant. If defined, this value will be used during checkout instead of normal shipping-cost calculation. */ - fixed_cost_shipping_price?: number; - /** If `true`, this variant will not be purchasable on the storefront. */ - purchasing_disabled?: boolean; - /** If `purchasing_disabled` is `true`, this message should show on the storefront when the variant is selected. */ - purchasing_disabled_message?: string; - /** The UPC code used in feeds for shopping comparison sites and external channel integrations. */ - upc?: string; - /** Inventory level for the variant, which is used when the product's inventory_tracking is set to `variant`. */ - inventory_level?: number; - /** When the variant hits this inventory level, it is considered low stock. */ - inventory_warning_level?: number; - /** Identifies where in a warehouse the variant is located. */ - bin_picking_number?: string; - } & { - id?: number; - product_id?: number; - sku?: string; - /** Read-only reference to v2 API's SKU ID. Null if it is a base variant. */ - sku_id?: number; - /** Array of option and option values IDs that make up this variant. Will be empty if the variant is the product's base variant. */ - option_values?: ({ - /** The name of the option. */ - option_display_name?: string; - /** The label of the option value. */ - label?: string; - } & { - id?: number; - option_id?: number; - })[]; - /** The price of the variant as seen on the storefront. This price takes into account `sale_price` and any price adjustment rules that are applicable to this variant. */ - calculated_price?: number; - })[]; - /** Data about the response, including pagination and collection totals. */ - meta?: { - /** Data about the response, including pagination and collection totals. */ - pagination?: { - /** Total number of items in the result set. */ - total?: number; - /** Total number of items in the collection response. */ - count?: number; - /** The amount of items returned in the collection per page, controlled by the limit parameter. */ - per_page?: number; - /** The page you are currently on within the collection. */ - current_page?: number; - /** The total number of pages in the collection. */ - total_pages?: number; - /** Pagination links for the previous and next parts of the whole collection. */ - links?: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - }; - }; - }; - }; - 413: unknown; - /** This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - batch_errors?: ({ - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - } & { - errors?: { - additionalProperties?: string; - }; - })[]; - }; - }; - }; - }; - /** - * Returns a lightweight inventory summary from the BigCommerce Catalog. - * - * The inventory summary includes: - * * "inventory_count" - * * "variant_count" - * * "inventory_value" - * * "highest_variant_price" - * * "average_variant_price" - * * "lowest_variant_price" - * * "oldest_variant_date" - * * "newest_variant_date" - * * "primary_category_id" - * * "primary_category_name" - */ - getCatalogSummary: { - parameters: { - header: { - Accept: unknown; - "Content-Type": unknown; - }; - }; - responses: { - 200: { - schema: { - /** Catalog Summary object describes a lightweight summary of the catalog. */ - data?: { - /** A count of all inventory items in the catalog. */ - inventory_count?: number; - /** Total value of store's inventory. */ - inventory_value?: number; - /** ID of the category containing the most products. */ - primary_category_id?: number; - /** Name of the category containing the most products. */ - primary_category_name?: string; - /** Total number of variants */ - variant_count?: number; - /** Highest priced variant */ - highest_variant_price?: number; - /** Average price of all variants */ - average_variant_price?: number; - /** Lowest priced variant in the store */ - lowest_variant_price?: string; - oldest_variant_date?: string; - newest_variant_date?: string; - }; - /** Empty meta object; may be used later. */ - meta?: { - [key: string]: any; - }; - }; - }; - }; - }; -} diff --git a/lib/connectors/big-commerce/types/catalog.v3.js b/lib/connectors/big-commerce/types/catalog.v3.js deleted file mode 100644 index 8fb5a2c..0000000 --- a/lib/connectors/big-commerce/types/catalog.v3.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -/** - * This file was auto-generated by openapi-typescript. - * Do not make direct changes to the file. - */ -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/connectors/big-commerce/types/customers.v3.d.ts b/lib/connectors/big-commerce/types/customers.v3.d.ts deleted file mode 100644 index f88cb54..0000000 --- a/lib/connectors/big-commerce/types/customers.v3.d.ts +++ /dev/null @@ -1,2083 +0,0 @@ -/** - * This file was auto-generated by openapi-typescript. - * Do not make direct changes to the file. - */ -export interface paths { - "/customers": { - /** - * Returns a list of Customers. Optional filter parameters can be passed in. - * - * **Notes** - * - * Attribute names are not available on the customer object. - */ - get: operations["CustomersGet"]; - /** - * Updates Customers. Subresource updates are not supported. Multiple customers can be updated in one call. - * - * **Required Fields** - * * id -- ID of the *Customer* This must be included in the request body - * - * **Read Only Fields** - * * id - * * registration_ip_address - * * date_created - * * date_modified - * - * - * **Notes** - * - * Attributes Values can not be updated using Update a Customer. Use the Update a [Customer Attribute Values](https://developer.bigcommerce.com/api-reference/customer-subscribers/v3-customers-api/customer-attribute-values/customersattributevaluesput) endpoint. - */ - put: operations["CustomersPut"]; - /** - * Creates Customers. Multiple customers can be created in one call. - * - * **Required Fields** - * * last_name - * * first_name - * * email - * - * **Required Fields Customer Address** - * * first_name - * * city - * * country_code - * * state_or_province - * * last_name - * * address1 - * * postal_code - * - * **Required Fields Attributes** - * * Attributes must be [created](https://developer.bigcommerce.com/api-reference/customer-subscribers/v3-customers-api/customer-attributes/customersattributespost) **BEFORE** creating a customer. - * * attribute_id - * * attribute_value -- This is input as a string, regardless of the [Type](/api-reference/customer-subscribers/v3-customers-api/models/type). - */ - post: operations["CustomersPost"]; - /** - * Deletes Customers. - * - * **Required Query** - * * id:in -- ID of the customer - * - * **Notes** - * - * A query is required to delete customers. If not provided, a 204 is returned, with no changes to the data. - */ - delete: operations["CustomersDelete"]; - }; - "/customers/addresses": { - /** Returns a list of Customer Addresses. Optional filter parameters can be passed in. */ - get: operations["CustomersAddressesGet"]; - /** - * Updates a Customer Address. Multiple customer addresses can be updated in one call. - * - * **Required Fields** - * * id -- ID of the *Customer Address* - * * customer_id -- ID of the *Customer*. - */ - put: operations["CustomersAddressesPut"]; - /** - * Creates a Customer Address. Multiple customer addresses can be created in one call. - * - * **Required Fields** - * * first_name - * * city - * * customer_id - * * country_code - * * state_or_province - * * last_name - * * address1 - * * postal_code - */ - post: operations["CustomersAddressesPost"]; - /** - * Deletes a Customer Address. - * - * **Required Query** - * * id:in -- ID of the *Customer Address* - */ - delete: operations["CustomersAddressesDelete"]; - }; - "/customers/attributes": { - /** Returns a list of Customer Attributes. Optional filter parameters can be passed in. */ - get: operations["CustomersAttributesGet"]; - /** - * Updates a Customer Attribute. Multiple customer attributes can be updated in one call. - * - * **Required Fields** - * * id -- ID of the *Customer Attribute* - * - * Once the data type is set, it can not be changed. The attribute will need to be deleted then created again with the new data type. This will also delete it from the customer. - */ - put: operations["CustomersAttributesPut"]; - /** - * Creates a Customer Attribute. Multiple customer attributes can be created in one call. - * - * **Required Fields** - * * name - * * type - * - * **Notes** - * - * Once the data type is set, it can not be changed. The attribute will need to be deleted then created again with the new data type. This will also delete it from the customer. - * - * Customer attributes are created separately from the customer. After the name and type are created, then the attributes can be added to the customer. - * - * A store cannot have more than 50 customer attributes. - */ - post: operations["CustomersAttributesPost"]; - /** - * Deletes Customer Attributes from the store. - * - * **Required Query** - * * id:in -- ID of the *Customer Attribute* - */ - delete: operations["CustomersAttributesDelete"]; - }; - "/customers/attribute-values": { - /** Returns a list of Customer Attribute Values. Optional filter parameters can be passed in. */ - get: operations["CustomersAttributeValuesGet"]; - /** - * Upserts Customer Attribute Values. Updates the attribute values on the Customer. Multiple customer attribute values can be updated in one call. - * - * Upsert checks for an existing record. If there is none, it creates the record, if there is a matching record, it updates that record. - * - * Up to 10 per call are allowed. - * - * **Required Fields** - * * customer_id -- ID of the *Customer* - * * id -- ID of the *Customer Attribute* - * * value -- Value of the *Customer Attribute* - */ - put: operations["CustomersAttributeValuesPut"]; - /** - * Deletes Customer Attribute Values. Deletes the attribute value from the customer. - * - * **Required Query** - * * id:in - ID of the *Customer Attribute Value* - */ - delete: operations["CustomersAttributeValuesDelete"]; - }; - "/customers/form-field-values": { - /** Returns a list of Form Field Values for the Customer or Customer Address object. */ - get: operations["CustomerFormFieldsGet"]; - /** - * Upserts Customer Form Field Values. Updates the form field values on the Customer or Customer Address. Multiple form field values can be updated in one call. - * - * Upsert checks for an existing record, if there is none it creates the record, if there is a matching record it updates that record. - * - * **Required Fields** - * * name - * * value - * * customer_id - * - * OR - * - * * name - * * value - * * address_id - */ - put: operations["CustomerFormFieldValuePUT"]; - }; - "/customers/{customerId}/consent": { - /** Gets the customer consent. */ - get: operations["CustomersConsentByCustomerId_GET"]; - /** Updates the customer consent. */ - put: operations["CustomersConsentByCustomerId_PUT"]; - }; -} -export interface definitions { - /** Data about the response, including pagination and collection totals. */ - Pagination: { - /** Total number of items in the result set. */ - total?: number; - /** Total number of items in the collection response. */ - count?: number; - /** The amount of items returned in the collection per page, controlled by the limit parameter. */ - per_page?: number; - /** The page you are currently on within the collection. */ - current_page?: number; - /** The total number of pages in the collection. */ - total_pages?: number; - /** Pagination links for the previous and next parts of the whole collection. */ - links?: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - }; - /** Data about the response, including pagination and collection totals. */ - _metaCollection: { - /** Data about the response, including pagination and collection totals. */ - pagination?: { - /** Total number of items in the result set. */ - total?: number; - /** Total number of items in the collection response. */ - count?: number; - /** The amount of items returned in the collection per page, controlled by the limit parameter. */ - per_page?: number; - /** The page you are currently on within the collection. */ - current_page?: number; - /** The total number of pages in the collection. */ - total_pages?: number; - /** Pagination links for the previous and next parts of the whole collection. */ - links?: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - }; - }; - ErrorResponse: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - /** Error payload for the BigCommerce API. */ - _error: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - }; - customer_Full: { - /** The email of the customer. Must be unique. */ - email?: string; - /** The first name of the customer. */ - first_name?: string; - /** The last name of the customer. */ - last_name?: string; - /** The company of the customer. */ - company?: string; - /** The phone number of the customer. */ - phone?: string; - /** The IP address from which this customer was registered. */ - registration_ip_address?: string; - /** The customer notes. */ - notes?: string; - /** The tax exempt category code for the customer. */ - tax_exempt_category?: string; - /** Id of the group which this customer belongs to. */ - customer_group_id?: number; - /** The unique numeric ID of the customer. */ - id?: number; - /** The date on which the customer was modified. */ - date_modified?: string; - /** The date of which the customer was created. */ - date_created?: string; - /** Total number of customer addresses */ - address_count?: number; - /** Total number of customer attributes */ - attribute_count?: number; - authentication?: { - /** If `true`, this customer will be forced to change password on next login. */ - force_password_reset?: boolean; - }; - /** Array of customer addresses. Limited to 10 */ - addresses?: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - /** The customer ID. */ - customer_id: number; - /** The unique numeric ID of the address. */ - id: number; - /** The country name of the customer address. */ - country?: string; - /** Array of form fields. Controlled by `formfields` parameter. */ - form_fields?: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - }[]; - /** Array of customer attributes. Limited to 10 */ - attributes?: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - value: string; - /** Attribute value ID. */ - id?: number; - /** Customer ID. */ - customer_id: number; - /** The date on which the customer attribute value was modified. */ - date_modified?: string; - /** The date of which the customer attribute value was created. */ - date_created?: string; - }[]; - /** Array of form fields. Controlled by `formfields` parameter. */ - form_fields?: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - /** Store credit. */ - store_credit_amounts?: { - amount?: number; - }[]; - /** It determines if the customer is signed up to receive either product review or abandoned cart emails or recieve both emails. */ - accepts_product_review_abandoned_cart_emails?: boolean; - channel_ids?: definitions["customerChannelIds"]; - }; - customer_Post: { - /** The email of the customer. Must be unique. */ - email: string; - /** The first name of the customer. */ - first_name: string; - /** The last name of the customer. */ - last_name: string; - /** The company of the customer. */ - company?: string; - /** The phone number of the customer. */ - phone?: string; - /** The customer notes. */ - notes?: string; - /** The tax exempt category code for the customer. */ - tax_exempt_category?: string; - /** Id of the group which this customer belongs to. */ - customer_group_id?: number; - /** Array of customer addresses. Limited to 10 */ - addresses?: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - }[]; - /** Array of customer attributes. Limited to 10 */ - attributes?: definitions["customerAttributes_Base"][]; - authentication?: { - /** If `true`, this customer will be forced to change password on next login. */ - force_password_reset?: boolean; - /** New password for customer. Write only field */ - new_password?: string; - }; - /** It determines if the customer is signed up to receive either product review or abandoned cart emails or recieve both emails. */ - accepts_product_review_abandoned_cart_emails?: boolean; - /** Store credit. */ - store_credit_amounts?: { - amount?: number; - }[]; - }; - customer_Put: { - /** The email of the customer. Must be unique. */ - email?: string; - /** The first name of the customer. */ - first_name?: string; - /** The last name of the customer. */ - last_name?: string; - /** The company of the customer. */ - company?: string; - /** The phone number of the customer. */ - phone?: string; - /** The IP address from which this customer was registered. */ - registration_ip_address?: string; - /** The customer notes. */ - notes?: string; - /** The tax exempt category code for the customer. */ - tax_exempt_category?: string; - /** Id of the group which this customer belongs to. */ - customer_group_id?: number; - /** The unique numeric ID of the customer. */ - id: number; - authentication?: { - /** If `true`, this customer will be forced to change password on next login. */ - force_password_reset?: boolean; - /** New password for customer. Write only field */ - new_password?: string; - }; - /** It determines if the customer is signed up to receive either product review or abandoned cart emails or recieve both emails. */ - accepts_product_review_abandoned_cart_emails?: boolean; - /** Store credit. */ - store_credit_amounts?: { - amount?: number; - }[]; - }; - attributeValue_Full: definitions["attribueValue_Base"] & { - /** The date on which the customer attribute value was modified. */ - date_modified?: string; - /** The date of which the customer attribute value was created. */ - date_created?: string; - }; - attribueValue_Base: { - /** Attribute value ID. */ - id?: number; - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - value: string; - /** Customer ID. */ - customer_id: number; - }; - customerAttributeValue_Full: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - attribute_value: string; - }; - attribute_Full: { - /** Attribute name. */ - name: string; - /** Attribute type should match one of: string, number, date. When doing a */ - type: "string" | "number" | "date"; - /** Attribute ID. */ - id: number; - /** The date on which the customer attribute was modified. */ - date_modified?: string; - /** The date of which the customer attribute was created. */ - date_created?: string; - }; - /** Once the data type is set, it can not be changed. The attribute will need to be deleted then created again with the new data type. This will also delete it from the customer. */ - attribute_Put: { - /** Attribute name. */ - name: string; - /** Attribute ID. */ - id: number; - }; - attribute_Post: { - /** Attribute name. */ - name: string; - /** Attribute type should match one of: string, number, date. When doing a */ - type: "string" | "number" | "date"; - }; - address_Full: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - /** The customer ID. */ - customer_id: number; - /** The unique numeric ID of the address. */ - id: number; - /** The country name of the customer address. */ - country?: string; - /** Array of form fields. Controlled by `formfields` parameter. */ - form_fields?: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - }; - address_Put: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - /** The customer ID. */ - customer_id: number; - /** The unique numeric ID of the address. */ - id: number; - }; - address_Post: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - /** The customer ID. */ - customer_id: number; - }; - /** The `address` object for the `customer` object's `addresses` array. */ - customerAddresses_Base: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - }; - customerAuthentication_PostPut: { - /** If `true`, this customer will be forced to change password on next login. */ - force_password_reset?: boolean; - } & { - /** New password for customer. Write only field */ - new_password?: string; - }; - customerAuthentication_Base: { - /** If `true`, this customer will be forced to change password on next login. */ - force_password_reset?: boolean; - }; - /** The address type. Residential or Commercial */ - addressType: "residential" | "commercial"; - /** Pagination links for the previous and next parts of the whole collection. */ - Links: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - /** Attribute type should match one of: string, number, date. When doing a */ - Type: "string" | "number" | "date"; - formFieldValue_Base: { - /** The form field name. */ - name: string; - value: string | number | string[]; - }; - CustomerFormFieldValue: { - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }; - formFieldValue_Full: { - /** The form field name. */ - name: string; - value: string | number | string[]; - customer_id: number; - } | { - /** The form field name. */ - name: string; - value: string | number | string[]; - /** The Customer Address ID. */ - address_id: number; - }; - formFieldValue_Put: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - /** Response payload for the BigCommerce API. */ - consent_Full: { - allow?: definitions["consentAllow"][]; - deny?: definitions["Deny"][]; - /** The date of which the customer consent was last updated. */ - updated_at?: string; - }; - /** Response payload for the BigCommerce API. */ - DeclareCustomerConsentResponse: { - /** Customer ID. */ - customer_id?: { - [key: string]: any; - }; - allow?: definitions["consentAllow"][]; - deny?: definitions["Deny"][]; - /** The date of which the customer consent was last updated. */ - updated_at?: string; - }; - consentAllow: "essential" | "functional" | "analytics" | "targeting"; - Deny: "essential" | "functional" | "analytics" | "targeting"; - /** Request payload for the BigCommerce API. */ - DeclareCustomerConsentRequest: { - allow?: definitions["consentAllow"][]; - deny?: definitions["Deny"][]; - }; - customer_Base: { - /** The email of the customer. Must be unique. */ - email?: string; - /** The first name of the customer. */ - first_name?: string; - /** The last name of the customer. */ - last_name?: string; - /** The company of the customer. */ - company?: string; - /** The phone number of the customer. */ - phone?: string; - /** The customer notes. */ - notes?: string; - /** The tax exempt category code for the customer. */ - tax_exempt_category?: string; - /** Id of the group which this customer belongs to. */ - customer_group_id?: number; - }; - /** Array of customer attributes. Limited to 10 */ - customerAttributes_Full: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - value: string; - /** Attribute value ID. */ - id?: number; - /** Customer ID. */ - customer_id: number; - /** The date on which the customer attribute value was modified. */ - date_modified?: string; - /** The date of which the customer attribute value was created. */ - date_created?: string; - }[]; - /** - * The `attributes` array for the `customer` object used in `POST` requests to `/customers`. - * - * Array of customer attributes. Limited to 10. - */ - customerAttributes_Base: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - value: string; - }[]; - attribute_Base: { - /** Attribute name. */ - name: string; - /** Attribute type should match one of: string, number, date. When doing a */ - type: "string" | "number" | "date"; - /** Attribute ID. */ - id: number; - /** The date on which the customer attribute was modified. */ - date_modified?: string; - /** The date of which the customer attribute was created. */ - date_created?: string; - }; - /** Array of channel ids the Customer has access to. */ - customerChannelIds: number[]; -} -export interface parameters { - /** Filter items by first_name and last_name. `name=moriarty,holmes` */ - FilterNameParam: string[]; - /** Filter items by email. `email:in=janedoe@email.com` */ - FilterEmailParam: string; - /** - * Filter items by substring in first_name and last_name (%substring% - use with % symbols). - * `name:like=moriarty&name:like=doe` - */ - FilterNameLikeParam: string[]; - /** - * Filter items by substring in first_name and last_name (%substring% - use with % symbols). - * `name:like=moriarty,doe` - */ - FilterAttributeNameLikeParam: string; - /** - * Filter items by id. - * `id:in=4,5,6` - */ - FilterIdParam: number[]; - /** Filter items by date_modified. `date_modified=2018-09-05T13:45:03` */ - FilterDateModifiedParam: string; - /** Filter items by mininum date_modified. `date_modified:min=2019-09-04T:00:00:00` or `date_modified:min=2019-09-04` */ - FilterDateModifiedMinParam: string; - /** Filter items by maximum date_modified `date_modified:max=2018-09-05T13:45:03` or `date_modified:max=2019-09-04` */ - FilterDateModifiedMaxParam: string; - /** Filter items by date_created. `date_created=2018-09-05T13:43:54` */ - FilterDateCreatedParam: string; - /** Filter items by date_created. `date_created:min=2018-09-05` */ - FilterDateCreatedMinParam: string; - /** Filter items by maximum date_created. `date_created:max=2018-09-10` */ - FilterDateCreatedMaxParam: string; - /** - * Filter items by registration_ip_address. If the customer was created using the API, then registration address is blank. - * `registration_ip_address:in=12.345.6.789` - */ - FilterCustomerRegistrationIPAddressParam: number[]; - /** Filter items by company. `company:in=bigcommerce,commongood` */ - FilterCompanyParam: string[]; - /** Filter items by customer_group_id. `customer_group_id:in=5,6` */ - FilterCustomerGroupParam: string[]; - /** The type of the customer attrribute. `type=string` */ - FilterCustomerAttributeTypeParam: "string" | "number" | "date"; - /** The attribute name for which we should return values. `name=age` */ - FilterAttributeValueByNameParam: string; - /** Page number. `page=1` */ - FilterPageParam: number; - /** Items count per page. `limit=50` */ - FilterLimitParam: number; - /** - * Indicates whether to include customer sub-resources: - * * `addresses` - customer addresses - * * `storecredit` - store credit - * * `attributes` - customer attributes and address attributes - * * `formfields` - customer and address form fields - * - * `include=addresses,storecredit,attributes,formfields` - */ - FilterCustomerIncludeParam: "addresses" | "storecredit" | "attributes" | "formfields"; - /** - * Indicates whether to include customer address sub-resources: - * * `formfields` - address form fields - * `include=formfields` - */ - FilterAddressIncludeParam: "formfields"; - Accept: string; - "Content-Type": string; - /** The ID of the customer. `customer_id:in=23,24,55` */ - FilterCustomerIdParam: number[]; - /** The attribute id for which we should return values. `attribute_id:in=1,2` */ - FilterAttributeIdParam: number[]; - /** The ID of the *Customer*. */ - FilterCustomerIdEqualsParam: number; - /** The ID of the *Customer Address*. */ - FilterAddressIdEqualsParam: number; - /** The fields name. */ - FilterFormFieldNameParam: string; - /** - * The field type. - * * `checkboxes` - checkboxes field - * * `date` - date field - * * `multiline` - multiline text field - * * `numbers` - numbers only field - * * `password` - password field - * * `radiobuttons` - radio buttons field - * * `text` - text field - * * `picklist` - pick list field - */ - FilterFormFieldTypeParam: "checkboxes" | "date" | "multiline" | "numbers" | "password" | "radiobuttons" | "text" | "picklist"; -} -export interface responses { - /** Customer Collection Response */ - CustomerCollectionResponse: { - schema: { - data?: definitions["customer_Full"][]; - meta?: definitions["_metaCollection"]; - }; - }; - /** Customer Response */ - CustomerResponse: { - schema: { - data?: definitions["customer_Full"][]; - meta?: { - [key: string]: any; - }; - }; - }; - AddressCollectionResponse: { - schema: { - data?: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - /** The customer ID. */ - customer_id: number; - /** The unique numeric ID of the address. */ - id: number; - /** The country name of the customer address. */ - country?: string; - /** Array of form fields. Controlled by `formfields` parameter. */ - form_fields?: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - }[]; - /** Data about the response, including pagination and collection totals. */ - meta?: { - /** Data about the response, including pagination and collection totals. */ - pagination?: { - /** Total number of items in the result set. */ - total?: number; - /** Total number of items in the collection response. */ - count?: number; - /** The amount of items returned in the collection per page, controlled by the limit parameter. */ - per_page?: number; - /** The page you are currently on within the collection. */ - current_page?: number; - /** The total number of pages in the collection. */ - total_pages?: number; - /** Pagination links for the previous and next parts of the whole collection. */ - links?: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - }; - }; - }; - }; - AddressResponse: { - schema: { - data?: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - /** The customer ID. */ - customer_id: number; - /** The unique numeric ID of the address. */ - id: number; - /** The country name of the customer address. */ - country?: string; - /** Array of form fields. Controlled by `formfields` parameter. */ - form_fields?: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - }[]; - meta?: { - [key: string]: any; - }; - }; - }; - CustomerAttributeValueCollectionResponse: { - schema: { - data?: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - value: string; - /** Attribute value ID. */ - id?: number; - /** Customer ID. */ - customer_id: number; - /** The date on which the customer attribute value was modified. */ - date_modified?: string; - /** The date of which the customer attribute value was created. */ - date_created?: string; - }[]; - /** Data about the response, including pagination and collection totals. */ - meta?: { - /** Data about the response, including pagination and collection totals. */ - pagination?: { - /** Total number of items in the result set. */ - total?: number; - /** Total number of items in the collection response. */ - count?: number; - /** The amount of items returned in the collection per page, controlled by the limit parameter. */ - per_page?: number; - /** The page you are currently on within the collection. */ - current_page?: number; - /** The total number of pages in the collection. */ - total_pages?: number; - /** Pagination links for the previous and next parts of the whole collection. */ - links?: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - }; - }; - }; - }; - CustomerAttributeValueResponse: { - schema: { - data?: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - value: string; - /** Attribute value ID. */ - id?: number; - /** Customer ID. */ - customer_id: number; - /** The date on which the customer attribute value was modified. */ - date_modified?: string; - /** The date of which the customer attribute value was created. */ - date_created?: string; - }[]; - meta?: { - [key: string]: any; - }; - }; - }; - CustomerAttributeCollectionResponse: { - schema: { - data?: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - value: string; - /** Attribute value ID. */ - id?: number; - /** Customer ID. */ - customer_id: number; - /** The date on which the customer attribute value was modified. */ - date_modified?: string; - /** The date of which the customer attribute value was created. */ - date_created?: string; - }[]; - /** Data about the response, including pagination and collection totals. */ - meta?: { - /** Data about the response, including pagination and collection totals. */ - pagination?: { - /** Total number of items in the result set. */ - total?: number; - /** Total number of items in the collection response. */ - count?: number; - /** The amount of items returned in the collection per page, controlled by the limit parameter. */ - per_page?: number; - /** The page you are currently on within the collection. */ - current_page?: number; - /** The total number of pages in the collection. */ - total_pages?: number; - /** Pagination links for the previous and next parts of the whole collection. */ - links?: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - }; - }; - }; - }; - CustomerAttributesResponse: { - schema: { - data?: { - /** Attribute name. */ - name: string; - /** Attribute type should match one of: string, number, date. When doing a */ - type: "string" | "number" | "date"; - /** Attribute ID. */ - id: number; - /** The date on which the customer attribute was modified. */ - date_modified?: string; - /** The date of which the customer attribute was created. */ - date_created?: string; - }[]; - meta?: { - [key: string]: any; - }; - }; - }; - FormFieldValueCollectionResponse: { - schema: { - data?: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - /** Data about the response, including pagination and collection totals. */ - meta?: { - /** Data about the response, including pagination and collection totals. */ - pagination?: { - /** Total number of items in the result set. */ - total?: number; - /** Total number of items in the collection response. */ - count?: number; - /** The amount of items returned in the collection per page, controlled by the limit parameter. */ - per_page?: number; - /** The page you are currently on within the collection. */ - current_page?: number; - /** The total number of pages in the collection. */ - total_pages?: number; - /** Pagination links for the previous and next parts of the whole collection. */ - links?: { - /** Link to the previous page returned in the response. */ - previous?: string; - /** Link to the current page returned in the response. */ - current?: string; - /** Link to the next page returned in the response. */ - next?: string; - }; - }; - }; - }; - }; - FormFieldValuesResponse: { - schema: { - data?: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - meta?: { - [key: string]: any; - }; - }; - }; - consent_Resp: { - schema: definitions["consent_Full"]; - }; -} -export interface operations { - /** - * Returns a list of Customers. Optional filter parameters can be passed in. - * - * **Notes** - * - * Attribute names are not available on the customer object. - */ - CustomersGet: { - parameters: { - query: { - /** Page number. `page=1` */ - page?: unknown; - /** Items count per page. `limit=50` */ - limit?: unknown; - /** - * Filter items by id. - * `id:in=4,5,6` - */ - "id:in"?: unknown; - /** Filter items by company. `company:in=bigcommerce,commongood` */ - "company:in"?: unknown; - /** Filter items by customer_group_id. `customer_group_id:in=5,6` */ - "customer_group_id:in"?: unknown; - /** Filter items by date_created. `date_created=2018-09-05T13:43:54` */ - date_created?: unknown; - /** Filter items by maximum date_created. `date_created:max=2018-09-10` */ - "date_created:max"?: unknown; - /** Filter items by date_created. `date_created:min=2018-09-05` */ - "date_created:min"?: unknown; - /** Filter items by date_modified. `date_modified=2018-09-05T13:45:03` */ - date_modified?: unknown; - /** Filter items by mininum date_modified. `date_modified:min=2019-09-04T:00:00:00` or `date_modified:min=2019-09-04` */ - "date_modified:min"?: unknown; - /** Filter items by maximum date_modified `date_modified:max=2018-09-05T13:45:03` or `date_modified:max=2019-09-04` */ - "date_modified:max"?: unknown; - /** Filter items by email. `email:in=janedoe@email.com` */ - "email:in"?: unknown; - /** Filter items by first_name and last_name. `name=james moriarty` */ - "name:in"?: unknown; - /** - * Filter items by substring in first_name and last_name. - * `name:like=moriarty, sherlock` - * Concatenates the first_name and last_name fields. - */ - "name:like"?: unknown; - /** - * Filter items by registration_ip_address. If the customer was created using the API, then registration address is blank. - * `registration_ip_address:in=12.345.6.789` - */ - "registration_ip_address:in"?: unknown; - /** - * Indicates whether to include customer sub-resources: - * * `addresses` - customer addresses - * * `storecredit` - store credit - * * `attributes` - customer attributes and address attributes - * * `formfields` - customer and address form fields - * - * `include=addresses,storecredit,attributes,formfields` - */ - include?: unknown; - /** - * Sort items by date_created or last_name: - * * `date_created:asc` - date created, ascending - * * `date_created:desc` - date created, descending - * * `last_name:asc` - last name, ascending - * * `last_name:desc` - last name, descending - * - * Example: `sort=last_name:asc` - */ - sort?: unknown; - }; - }; - responses: { - 200: responses["CustomerCollectionResponse"]; - }; - }; - /** - * Updates Customers. Subresource updates are not supported. Multiple customers can be updated in one call. - * - * **Required Fields** - * * id -- ID of the *Customer* This must be included in the request body - * - * **Read Only Fields** - * * id - * * registration_ip_address - * * date_created - * * date_modified - * - * - * **Notes** - * - * Attributes Values can not be updated using Update a Customer. Use the Update a [Customer Attribute Values](https://developer.bigcommerce.com/api-reference/customer-subscribers/v3-customers-api/customer-attribute-values/customersattributevaluesput) endpoint. - */ - CustomersPut: { - parameters: { - body: { - body: { - /** The email of the customer. Must be unique. */ - email?: string; - /** The first name of the customer. */ - first_name?: string; - /** The last name of the customer. */ - last_name?: string; - /** The company of the customer. */ - company?: string; - /** The phone number of the customer. */ - phone?: string; - /** The IP address from which this customer was registered. */ - registration_ip_address?: string; - /** The customer notes. */ - notes?: string; - /** The tax exempt category code for the customer. */ - tax_exempt_category?: string; - /** Id of the group which this customer belongs to. */ - customer_group_id?: number; - /** The unique numeric ID of the customer. */ - id: number; - authentication?: { - /** If `true`, this customer will be forced to change password on next login. */ - force_password_reset?: boolean; - /** New password for customer. Write only field */ - new_password?: string; - }; - /** It determines if the customer is signed up to receive either product review or abandoned cart emails or recieve both emails. */ - accepts_product_review_abandoned_cart_emails?: boolean; - /** Store credit. */ - store_credit_amounts?: { - amount?: number; - }[]; - }[]; - }; - }; - responses: { - 200: responses["CustomerCollectionResponse"]; - /** The `Customer` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** - * Creates Customers. Multiple customers can be created in one call. - * - * **Required Fields** - * * last_name - * * first_name - * * email - * - * **Required Fields Customer Address** - * * first_name - * * city - * * country_code - * * state_or_province - * * last_name - * * address1 - * * postal_code - * - * **Required Fields Attributes** - * * Attributes must be [created](https://developer.bigcommerce.com/api-reference/customer-subscribers/v3-customers-api/customer-attributes/customersattributespost) **BEFORE** creating a customer. - * * attribute_id - * * attribute_value -- This is input as a string, regardless of the [Type](/api-reference/customer-subscribers/v3-customers-api/models/type). - */ - CustomersPost: { - parameters: { - body: { - body: { - /** The email of the customer. Must be unique. */ - email: string; - /** The first name of the customer. */ - first_name: string; - /** The last name of the customer. */ - last_name: string; - /** The company of the customer. */ - company?: string; - /** The phone number of the customer. */ - phone?: string; - /** The customer notes. */ - notes?: string; - /** The tax exempt category code for the customer. */ - tax_exempt_category?: string; - /** Id of the group which this customer belongs to. */ - customer_group_id?: number; - /** Array of customer addresses. Limited to 10 */ - addresses?: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - }[]; - /** Array of customer attributes. Limited to 10 */ - attributes?: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - attribute_value: string; - }[]; - authentication?: { - /** If `true`, this customer will be forced to change password on next login. */ - force_password_reset?: boolean; - /** New password for customer. Write only field */ - new_password?: string; - }; - /** It determines if the customer is signed up to receive either product review or abandoned cart emails or recieve both emails. */ - accepts_product_review_abandoned_cart_emails?: boolean; - /** Store credit. */ - store_credit_amounts?: { - amount?: number; - }[]; - }[]; - }; - }; - responses: { - 200: responses["CustomerCollectionResponse"]; - /** The *Customer* was not valid. This is the result of missing required fields or trying to edit a read only field. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** - * Deletes Customers. - * - * **Required Query** - * * id:in -- ID of the customer - * - * **Notes** - * - * A query is required to delete customers. If not provided, a 204 is returned, with no changes to the data. - */ - CustomersDelete: { - parameters: { - query: { - /** - * Filter items by id. - * `id:in=4,5,6` - */ - "id:in": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of Customer Addresses. Optional filter parameters can be passed in. */ - CustomersAddressesGet: { - parameters: { - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - query: { - /** Page number. `page=1` */ - page?: unknown; - /** Items count per page. `limit=50` */ - limit?: unknown; - /** Filter items by company. `company:in=bigcommerce,commongood` */ - "company:in"?: unknown; - /** Filter items by first_name and last_name. `name=moriarty,holmes` */ - name?: unknown; - /** The ID of the customer. `customer_id:in=23,24,55` */ - "customer_id:in"?: unknown; - /** - * Indicates whether to include customer address sub-resources: - * * `formfields` - address form fields - * `include=formfields` - */ - include?: unknown; - /** - * Filter items by id. - * `id:in=4,5,6` - */ - "id:in"?: unknown; - }; - }; - responses: { - 200: responses["AddressCollectionResponse"]; - }; - }; - /** - * Updates a Customer Address. Multiple customer addresses can be updated in one call. - * - * **Required Fields** - * * id -- ID of the *Customer Address* - * * customer_id -- ID of the *Customer*. - */ - CustomersAddressesPut: { - parameters: { - body: { - body: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - /** The customer ID. */ - customer_id: number; - /** The unique numeric ID of the address. */ - id: number; - }[]; - }; - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - }; - responses: { - 200: responses["AddressCollectionResponse"]; - /** The `Address` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** - * Creates a Customer Address. Multiple customer addresses can be created in one call. - * - * **Required Fields** - * * first_name - * * city - * * customer_id - * * country_code - * * state_or_province - * * last_name - * * address1 - * * postal_code - */ - CustomersAddressesPost: { - parameters: { - body: { - body: { - /** The first name of the customer address. */ - first_name: string; - /** The last name of the customer address. */ - last_name: string; - /** The company of the customer address. */ - company?: string; - /** The address 1 line. */ - address1: string; - /** The address 2 line. */ - address2?: string; - /** The city of the customer address. */ - city: string; - /** The state or province name */ - state_or_province: string; - /** The postal code of the customer address. */ - postal_code: string; - /** The country code of the customer address. */ - country_code: string; - /** The phone number of the customer address. */ - phone?: string; - /** The address type. Residential or Commercial */ - address_type?: "residential" | "commercial"; - /** The customer ID. */ - customer_id: number; - }[]; - }; - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - }; - responses: { - 200: responses["AddressCollectionResponse"]; - /** The `Address` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** - * Deletes a Customer Address. - * - * **Required Query** - * * id:in -- ID of the *Customer Address* - */ - CustomersAddressesDelete: { - parameters: { - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - query: { - /** - * Filter items by id. - * `id:in=4,5,6` - */ - "id:in": unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of Customer Attributes. Optional filter parameters can be passed in. */ - CustomersAttributesGet: { - parameters: { - query: { - /** Page number. `page=1` */ - page?: unknown; - /** Items count per page. `limit=50` */ - limit?: unknown; - /** Filter items by first_name and last_name. */ - "name:in"?: unknown; - /** Filter items by substring in first_name and last_name (%substring% - use with % symbols). */ - "name:like"?: unknown; - /** The type of the customer attrribute. */ - type?: unknown; - /** Filter items by date_created. */ - date_created?: unknown; - /** Filter items by date_created. */ - "date_created:max"?: unknown; - /** Filter items by date_created. */ - "date_created:min"?: unknown; - /** Filter items by date_modified. */ - date_modified?: unknown; - /** Filter items by date_modified. */ - "date_modified:max"?: unknown; - /** Filter items by date_modified. */ - "date_modified:min"?: unknown; - }; - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - }; - responses: { - 200: responses["CustomerAttributesResponse"]; - }; - }; - /** - * Updates a Customer Attribute. Multiple customer attributes can be updated in one call. - * - * **Required Fields** - * * id -- ID of the *Customer Attribute* - * - * Once the data type is set, it can not be changed. The attribute will need to be deleted then created again with the new data type. This will also delete it from the customer. - */ - CustomersAttributesPut: { - parameters: { - body: { - body: definitions["attribute_Put"][]; - }; - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - }; - responses: { - 200: responses["CustomerAttributesResponse"]; - /** The `Attribute` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** - * Creates a Customer Attribute. Multiple customer attributes can be created in one call. - * - * **Required Fields** - * * name - * * type - * - * **Notes** - * - * Once the data type is set, it can not be changed. The attribute will need to be deleted then created again with the new data type. This will also delete it from the customer. - * - * Customer attributes are created separately from the customer. After the name and type are created, then the attributes can be added to the customer. - * - * A store cannot have more than 50 customer attributes. - */ - CustomersAttributesPost: { - parameters: { - body: { - body: { - /** Attribute name. */ - name: string; - /** Attribute type should match one of: string, number, date. */ - type: "string" | "number" | "date"; - }[]; - }; - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - }; - responses: { - 200: responses["CustomerAttributesResponse"]; - /** The `Attribute` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** - * Deletes Customer Attributes from the store. - * - * **Required Query** - * * id:in -- ID of the *Customer Attribute* - */ - CustomersAttributesDelete: { - parameters: { - query: { - /** Filter items by id. */ - "id:in": unknown; - }; - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of Customer Attribute Values. Optional filter parameters can be passed in. */ - CustomersAttributeValuesGet: { - parameters: { - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - query: { - /** Page number. `page=1` */ - page?: unknown; - /** Items count per page. `limit=50` */ - limit?: unknown; - /** The ID of the customer. `customer_id:in=23,24,55` */ - "customer_id:in"?: unknown; - /** The attribute id for which we should return values. `attribute_id:in=1,2` */ - "attribute_id:in"?: unknown; - /** The attribute name for which we should return values. `name=age` */ - name?: unknown; - /** Filter items by date_created. `date_created=2018-09-05T13:43:54` */ - date_created?: unknown; - /** Filter items by maximum date_created. `date_created:max=2018-09-10` */ - "date_created:max"?: unknown; - /** Filter items by date_created. `date_created:min=2018-09-05` */ - "date_created:min"?: unknown; - /** Filter items by date_modified. `date_modified=2018-09-05T13:45:03` */ - date_modified?: unknown; - /** Filter items by maximum date_modified `date_modified:max=2018-09-05T13:45:03` or `date_modified:max=2019-09-04` */ - "date_modified:max"?: unknown; - /** Filter items by mininum date_modified. `date_modified:min=2019-09-04T:00:00:00` or `date_modified:min=2019-09-04` */ - "date_modified:min"?: unknown; - }; - }; - responses: { - 200: responses["CustomerAttributeValueCollectionResponse"]; - }; - }; - /** - * Upserts Customer Attribute Values. Updates the attribute values on the Customer. Multiple customer attribute values can be updated in one call. - * - * Upsert checks for an existing record. If there is none, it creates the record, if there is a matching record, it updates that record. - * - * Up to 10 per call are allowed. - * - * **Required Fields** - * * customer_id -- ID of the *Customer* - * * id -- ID of the *Customer Attribute* - * * value -- Value of the *Customer Attribute* - */ - CustomersAttributeValuesPut: { - parameters: { - body: { - body: { - /** Attribute ID. */ - attribute_id: number; - /** Attribute value. This will always be a string, regardless of the attributes type. */ - value: string; - /** Attribute value ID. */ - id?: number; - /** Customer ID. */ - customer_id: number; - }[]; - }; - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - }; - responses: { - 200: responses["CustomerAttributeValueCollectionResponse"]; - /** The `CustomerAttributeValue` was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** - * Deletes Customer Attribute Values. Deletes the attribute value from the customer. - * - * **Required Query** - * * id:in - ID of the *Customer Attribute Value* - */ - CustomersAttributeValuesDelete: { - parameters: { - query: { - /** - * Filter items by id. - * `id:in=4,5,6` - */ - "id:in": unknown; - }; - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - }; - responses: { - 204: never; - }; - }; - /** Returns a list of Form Field Values for the Customer or Customer Address object. */ - CustomerFormFieldsGet: { - parameters: { - header: { - Accept?: unknown; - "Content-Type"?: unknown; - }; - query: { - /** Page number. `page=1` */ - page?: unknown; - /** Items count per page. `limit=50` */ - limit?: unknown; - /** The ID of the *Customer*. */ - customer_id?: unknown; - /** The ID of the *Customer Address*. */ - address_id?: unknown; - /** The fields name. */ - field_name?: unknown; - /** - * The field type. - * * `checkboxes` - checkboxes field - * * `date` - date field - * * `multiline` - multiline text field - * * `numbers` - numbers only field - * * `password` - password field - * * `radiobuttons` - radio buttons field - * * `text` - text field - * * `picklist` - pick list field - */ - field_type?: unknown; - }; - }; - responses: { - 200: responses["FormFieldValueCollectionResponse"]; - /** The form field value was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** - * Upserts Customer Form Field Values. Updates the form field values on the Customer or Customer Address. Multiple form field values can be updated in one call. - * - * Upsert checks for an existing record, if there is none it creates the record, if there is a matching record it updates that record. - * - * **Required Fields** - * * name - * * value - * * customer_id - * - * OR - * - * * name - * * value - * * address_id - */ - CustomerFormFieldValuePUT: { - parameters: { - body: { - body?: (({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - customer_id: number; - }) | ({ - /** The form field name. */ - name: string; - value: string | number | string[]; - } & { - /** The Customer Address ID. */ - address_id: number; - }))[]; - }; - }; - responses: { - 200: responses["FormFieldValueCollectionResponse"]; - /** The form field value was not valid. This is the result of missing required fields, or of invalid data. See the response for more details. */ - 422: { - schema: { - /** The HTTP status code. */ - status?: number; - /** The error title describing the particular error. */ - title?: string; - type?: string; - instance?: string; - errors?: { - [key: string]: string; - }; - }; - }; - }; - }; - /** Gets the customer consent. */ - CustomersConsentByCustomerId_GET: { - parameters: { - path: { - customerId: unknown; - }; - }; - responses: { - 200: responses["consent_Resp"]; - /** Unauthorized - the v3 Auth client ID or token in the request are not a valid combination for this store. */ - 401: { - schema: definitions["ErrorResponse"]; - }; - /** Missing scope - the v3 Auth token is valid but does not have proper permissions to access this endpoint. */ - 403: { - schema: definitions["ErrorResponse"]; - }; - /** Invalid JSON request body - missing or invalid data. */ - 422: { - schema: definitions["ErrorResponse"]; - }; - }; - }; - /** Updates the customer consent. */ - CustomersConsentByCustomerId_PUT: { - parameters: { - header: { - "Content-Type"?: unknown; - }; - body: { - body?: definitions["DeclareCustomerConsentRequest"]; - }; - path: { - customerId: unknown; - }; - }; - responses: { - 200: responses["consent_Resp"]; - /** Unauthorized - the v3 Auth client ID or token in the request are not a valid combination for this store. */ - 401: { - schema: definitions["ErrorResponse"]; - }; - /** Missing scope - the v3 Auth token is valid but does not have proper permissions to access this endpoint. */ - 403: { - schema: definitions["ErrorResponse"]; - }; - /** Invalid JSON request body - missing or invalid data. */ - 422: { - schema: definitions["ErrorResponse"]; - }; - }; - }; -} diff --git a/lib/connectors/big-commerce/types/customers.v3.js b/lib/connectors/big-commerce/types/customers.v3.js deleted file mode 100644 index 8fb5a2c..0000000 --- a/lib/connectors/big-commerce/types/customers.v3.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -/** - * This file was auto-generated by openapi-typescript. - * Do not make direct changes to the file. - */ -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/connectors/big-commerce/types/index.d.ts b/lib/connectors/big-commerce/types/index.d.ts deleted file mode 100644 index b27119c..0000000 --- a/lib/connectors/big-commerce/types/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * as catalogV3 from "./catalog.v3"; -export * as customersV3 from "./customers.v3"; diff --git a/lib/connectors/big-commerce/types/index.js b/lib/connectors/big-commerce/types/index.js deleted file mode 100644 index 8a8a2f9..0000000 --- a/lib/connectors/big-commerce/types/index.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.customersV3 = exports.catalogV3 = void 0; -exports.catalogV3 = __importStar(require("./catalog.v3")); -exports.customersV3 = __importStar(require("./customers.v3")); diff --git a/lib/connectors/bundle-b2b/client.d.ts b/lib/connectors/bundle-b2b/client.d.ts deleted file mode 100644 index f1bc620..0000000 --- a/lib/connectors/bundle-b2b/client.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as t from "io-ts"; -import { MutableReference } from "../../framework"; -export declare type Config = t.TypeOf; -export declare const configSchema: t.IntersectionC<[t.TypeC<{ - storeAlias: t.StringC; - storeHash: t.StringC; - credentials: t.TypeC<{ - email: t.StringC; - password: t.StringC; - }>; -}>, t.PartialC<{ - token: t.TypeC<{ - value: t.StringC; - expiration: t.NumberC; - }>; -}>]>; -export default class BundleB2b { - private readonly config; - constructor(config: MutableReference); - private readonly readAgent; - private readonly writeAgent; - get(uri: string, params?: Record): Promise; - list(uri: string, params?: Record): AsyncIterable; - post(uri: string, content: any): Promise; - put(uri: string, content: any): Promise; - patch(uri: string, content: any): Promise; - delete(uri: string, params?: Record): Promise; - private doGet; - private makeRequestWithContent; - private fetch; - private init; - private refreshToken; - private getToken; -} diff --git a/lib/connectors/bundle-b2b/client.js b/lib/connectors/bundle-b2b/client.js deleted file mode 100644 index 0788bba..0000000 --- a/lib/connectors/bundle-b2b/client.js +++ /dev/null @@ -1,212 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.configSchema = void 0; -const node_fetch_1 = __importDefault(require("node-fetch")); -const query_string_1 = require("query-string"); -const p_retry_1 = __importDefault(require("p-retry")); -const t = __importStar(require("io-ts")); -const framework_1 = require("../../framework"); -const https_1 = require("https"); -const ramda_1 = __importDefault(require("ramda")); -const listConcurrency = 50; -exports.configSchema = t.intersection([ - t.type({ - storeAlias: t.string, - storeHash: t.string, - credentials: t.type({ - email: t.string, - password: t.string, - }), - }), - t.partial({ - token: t.type({ - value: t.string, - expiration: t.number, - }), - }), -]); -class BundleB2b { - constructor(config) { - this.config = config; - this.readAgent = new https_1.Agent({ - keepAlive: true, - maxSockets: 100, - }); - this.writeAgent = new https_1.Agent({ - keepAlive: true, - maxSockets: 10, - }); - } - async get(uri, params) { - return unwrap(await this.doGet(uri, params)); - } - async *list(uri, params) { - var _a, _b; - // a lot of list reqs involve a single page or don't support pagination, only do one req in those cases - const firstPage = await this.doGet(uri, { offset: 0, ...(params || {}) }); - if (!firstPage) { - return; - } - yield* unwrap(firstPage); - const totalPages = uri.startsWith("v3") - ? ((_a = firstPage.meta) === null || _a === void 0 ? void 0 : _a.pagination) ? computeNumPages(firstPage.meta.pagination) - : 1 - : Number.MAX_SAFE_INTEGER; - const concurrency = Math.min(totalPages, listConcurrency); - const limit = (_b = firstPage.meta) === null || _b === void 0 ? void 0 : _b.pagination.limit; - const threads = [...new Array(concurrency).keys()]; - for (let page = 2; page <= totalPages; page += concurrency) { - const pages = await Promise.all(threads.map(threadId => this.get(uri, { - offset: (page + threadId) * limit - limit, - ...(params || {}), - }))); - const nonNullPages = pages.filter(Boolean); - yield* ramda_1.default.flatten(nonNullPages); - const lastPage = pages.slice(-1)[0]; - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) { - break; - } - } - } - async post(uri, content) { - return this.makeRequestWithContent("POST", uri, content); - } - async put(uri, content) { - return this.makeRequestWithContent("PUT", uri, content); - } - async patch(uri, content) { - return this.makeRequestWithContent("PATCH", uri, content); - } - async delete(uri, params) { - const paramsString = params ? `?${query_string_1.stringify(params, { arrayFormat: "comma" })}` : ""; - return unwrap(await this.fetch(this.writeAgent, uri + paramsString, { - ...params, - method: "DELETE", - })); - } - async doGet(uri, params) { - const paramsString = params ? `?${query_string_1.stringify(params, { arrayFormat: "comma" })}` : ""; - return await this.fetch(this.readAgent, uri + paramsString); - } - async makeRequestWithContent(method, uri, content) { - return unwrap(await this.fetch(this.writeAgent, uri, { - method, - headers: content && { - "Content-Type": "application/json", - }, - body: content && JSON.stringify(content), - })); - } - async fetch(agent, relativeUri, init) { - var _a; - const config = this.config.get(); - const absoluteUri = `https://api.bundleb2b.net/api/${relativeUri}`; - const initResolved = this.init(agent, (_a = config.token) !== null && _a !== void 0 ? _a : (await this.refreshToken()).token, init); - // response body may only be consumed once, so we have to memoize the result here - let responseText; - const response = await p_retry_1.default(async () => { - const response = await node_fetch_1.default(absoluteUri, initResolved); - responseText = response.text(); - if (response.status === 422) { - if ((await responseText).includes("saving error")) { - throw new Error(); // this will trigger a retry - } - } - if (response.status === 429 || (response.status >= 500 && response.status < 600)) { - throw new Error(); // this will trigger a retry - } - return response; - }, { retries: 50, minTimeout: 2500 }); - if (!response.ok) { - throw new framework_1.EndpointError(`${response.status} ${response.statusText}`, { - detail: await responseText - .then(JSON.parse) - .then(data => (data.errors && JSON.stringify(data.errors) !== "{}" ? data.errors : data.title) || - data) - .catch(), - }); - } - if (response.status === 204) { - return null; - } - return await responseText.then(JSON.parse); - } - init(agent, token, init) { - const headers = { - ...init === null || init === void 0 ? void 0 : init.headers, - "Content-Type": "application/json", - Accept: "application/json", - authToken: token.value, - }; - return { - ...init, - headers, - agent, - }; - } - async refreshToken() { - const config = this.config.get(); - const token = await this.getToken(config); - const updatedConfig = { ...config, token }; - return updatedConfig; - } - async getToken(config) { - const now = Math.floor(Date.now() / 1000); - const fourHoursFromNow = now + 4 * 3600; - const tokenResponse = await node_fetch_1.default("https://api.bundleb2b.net/api/io/auth/backend", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - storeHash: config.storeHash, - ...config.credentials, - name: `sdm-${fourHoursFromNow}`, - channelId: 1, - beginAt: now, - endAt: fourHoursFromNow, - }), - }); - if (!tokenResponse.ok) { - throw new Error(`Cannot refresh BundleB2B token for ${config.storeHash}`); - } - const token = await tokenResponse.json(); - if (token.code === 422) { - throw new Error(`Cannot refresh BundleB2B token for ${config.storeHash}`); - } - return { - value: token.data.token, - expiration: fourHoursFromNow, - }; - } -} -exports.default = BundleB2b; -function unwrap(content) { - return (content === null || content === void 0 ? void 0 : content.data) === undefined ? content : content.data; -} -function computeNumPages(pagination) { - // This differs to BC pagination - return pagination.totalCount === 0 ? 0 : Math.ceil(pagination.totalCount / pagination.limit); -} diff --git a/lib/connectors/bundle-b2b/functions.d.ts b/lib/connectors/bundle-b2b/functions.d.ts deleted file mode 100644 index 25496f0..0000000 --- a/lib/connectors/bundle-b2b/functions.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import BundleB2b from "./client"; -import { DocId, EndpointDefinition, Path } from "../../framework"; -export interface Query { - [key: string]: any; -} -export declare class endpoint { - private constructor(); - static crud(uriPattern: string, idField?: string): { - endpoints: { - create: EndpointDefinition; - list: EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BundleB2b) => (path: Path) => AsyncIterable; - endpoints: { - delete: EndpointDefinition; - get: EndpointDefinition; - update: EndpointDefinition; - }; - }; - }; - static fn(uriPattern: string, _fn: (client: BundleB2b, uri: string, data: I, path: ReadonlyArray) => Promise | AsyncIterable): EndpointDefinition; - static create: (uriPattern: string) => EndpointDefinition; - static del: (uriPattern: string) => EndpointDefinition; - static get: (uriPattern: string) => EndpointDefinition; - static list: (uriPattern: string) => EndpointDefinition; - static update: (uriPattern: string) => EndpointDefinition; -} -export declare class UriTemplate { - static uri(uriTemplate: string, fieldValues: ReadonlyArray): string; - static applyValues(uriTemplate: string, fieldValues: ReadonlyArray): string; - static fields(uriTemplate: string): string[]; -} -export declare function listIds(uriPattern: string, idField?: string): (client: BundleB2b) => (path: Path) => AsyncIterable; diff --git a/lib/connectors/bundle-b2b/functions.js b/lib/connectors/bundle-b2b/functions.js deleted file mode 100644 index 48360b0..0000000 --- a/lib/connectors/bundle-b2b/functions.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.listIds = exports.UriTemplate = exports.endpoint = void 0; -const framework_1 = require("../../framework"); -const json_pipe_1 = require("@space48/json-pipe"); -class endpoint { - constructor() { - return; - } - static crud(uriPattern, idField = "id") { - const docUriPattern = `${uriPattern}/{id}`; - return framework_1.resource({ - endpoints: { - create: endpoint.create(uriPattern), - list: endpoint.list(uriPattern), - }, - documents: { - idField, - listIds: listIds(uriPattern, idField), - endpoints: { - delete: endpoint.del(docUriPattern), - get: endpoint.get(docUriPattern), - update: endpoint.update(docUriPattern), - }, - }, - }); - } - static fn(uriPattern, _fn) { - return client => ({ path, input }) => { - const uri = UriTemplate.uri(uriPattern, framework_1.Path.getDocIds(path)); - return _fn(client, uri, input, framework_1.Path.getDocIds(path)); - }; - } -} -exports.endpoint = endpoint; -endpoint.create = (uriPattern) => endpoint.fn(uriPattern, (bB2bClient, uri, data) => bB2bClient.post(uri, data)); -endpoint.del = (uriPattern) => endpoint.fn(uriPattern, (bB2bClient, uri, data) => bB2bClient.delete(uri, data)); -endpoint.get = (uriPattern) => endpoint.fn(uriPattern, (bB2bClient, uri, data) => bB2bClient.get(uri, data)); -endpoint.list = (uriPattern) => endpoint.fn(uriPattern, (bB2bClient, uri, query) => bB2bClient.list(uri, query)); -endpoint.update = (uriPattern) => endpoint.fn(uriPattern, (bB2bClient, uri, data) => bB2bClient.put(uri, data)); -class UriTemplate { - static uri(uriTemplate, fieldValues) { - const uri = UriTemplate.applyValues(uriTemplate, fieldValues); - const missingValues = UriTemplate.fields(uri); - if (UriTemplate.fields(uri).length > 0) { - throw new Error(`Missing URI fields ${missingValues.join(", ")}`); - } - return uri; - } - static applyValues(uriTemplate, fieldValues) { - return UriTemplate.fields(uriTemplate) - .filter((field, index) => { var _a; return ((_a = fieldValues[index]) !== null && _a !== void 0 ? _a : null) !== null; }) - .reduce((uri, field, index) => uri.replace(`{${field}}`, String(fieldValues[index])), uriTemplate); - } - static fields(uriTemplate) { - var _a; - // todo: convert to matchAll once we support ES2020 - return (((_a = uriTemplate.match(/\{[^}]+\}/g)) === null || _a === void 0 ? void 0 : _a.map(match => match.substring(1, match.length - 1))) || []); - } -} -exports.UriTemplate = UriTemplate; -function listIds(uriPattern, idField = "id") { - return (client) => (path) => { - const uri = UriTemplate.uri(uriPattern, framework_1.Path.getDocIds(path)); - const docs = client.list(uri, { include_fields: [] }); - return json_pipe_1.pipe(docs, json_pipe_1.map(doc => doc[idField])); - }; -} -exports.listIds = listIds; diff --git a/lib/connectors/bundle-b2b/index.d.ts b/lib/connectors/bundle-b2b/index.d.ts deleted file mode 100644 index 708b0d1..0000000 --- a/lib/connectors/bundle-b2b/index.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import BundleB2b, { Config } from "./client"; -import * as f from "../../framework"; -export declare type BundleB2bConfig = Config; -export declare const bundleB2b: f.Connector<{ - storeAlias: string; - storeHash: string; - credentials: { - email: string; - password: string; - }; -} & { - token?: { - value: string; - expiration: number; - } | undefined; -}, BundleB2b, { - companies: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BundleB2b) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - users: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BundleB2b) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - addresses: { - endpoints: { - create: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: BundleB2b) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; -}>; diff --git a/lib/connectors/bundle-b2b/index.js b/lib/connectors/bundle-b2b/index.js deleted file mode 100644 index 5bc2768..0000000 --- a/lib/connectors/bundle-b2b/index.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.bundleB2b = void 0; -const client_1 = __importStar(require("./client")); -const framework_1 = require("../../framework"); -const functions_1 = require("./functions"); -const mergeResources = framework_1.resourceMerger(); -exports.bundleB2b = framework_1.connector({ - configSchema: client_1.configSchema, - scopeNameExample: "some-store-alias", - getScopeName: config => config.storeAlias, - getScope: config => new client_1.default(config), - getWarningMessage: async (client) => Promise.resolve(), - resources: { - companies: functions_1.endpoint.crud("v3/io/companies"), - users: functions_1.endpoint.crud("v3/io/users"), - addresses: functions_1.endpoint.crud("v3/io/addresses"), - }, -}); diff --git a/lib/connectors/config-management/index.d.ts b/lib/connectors/config-management/index.d.ts deleted file mode 100644 index db60e91..0000000 --- a/lib/connectors/config-management/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { ConfigRepository, Connector, Path, ScopeRef, DocId } from "../../framework"; -import * as f from "../../framework"; -export declare const configManagementConnector: (connectors: Readonly>, repository: ConfigRepository) => Connector ({ input }: f.EndpointPayload) => Promise; - export: () => () => Promise; - }; - }; - connectors: { - endpoints: { - list: () => () => AsyncGenerator; - }; - documents: { - idField: string; - listIds: () => () => AsyncGenerator; - resources: { - scopes: { - endpoints: { - add: (context: Context) => ({ docId: [connectorName], input: scopeConfig }: f.EndpointPayload) => Promise; - save: (context: Context) => ({ docId: [connectorName], input: scopeConfig }: f.EndpointPayload) => Promise; - list: () => ({ docId: [connectorName] }: f.EndpointPayload) => AsyncGenerator; - }; - documents: { - idField: string; - listIds: () => (path: Path) => AsyncGenerator; - endpoints: { - delete: (context: Context) => ({ docId: [connector, scope] }: f.EndpointPayload) => Promise; - get: (context: Context) => ({ docId: [connector, scope] }: f.EndpointPayload) => Promise; - update: (context: Context) => ({ docId: [connector, scope], input }: f.EndpointPayload) => Promise; - }; - resources: { - fields: { - documents: { - idField: string; - endpoints: { - delete: (context: Context) => ({ docId: [connector, scope, field] }: f.EndpointPayload) => Promise; - get: (context: Context) => ({ docId: [connector, scope, field] }: f.EndpointPayload) => Promise; - set: (context: Context) => ({ docId: [connector, scope, field], input }: f.EndpointPayload) => Promise; - }; - }; - }; - }; - }; - }; - }; - }; - }; -}>; -declare class Context { - private readonly connectors; - private readonly repository; - constructor(connectors: Readonly>, repository: ConfigRepository); - validateConnectorName(name: DocId): void; - connector(name: DocId): Connector; - scope(connector: DocId, scope: DocId): ScopeRef; - getConfig(connectorName: DocId, scope: DocId): Promise; - addConfig(connectorName: DocId, config: T): Promise; - setConfig(connectorName: DocId, config: T): Promise; - updateConfig(connectorName: DocId, scope: DocId, fn: (existingConfig: T) => T): Promise; - updateConfig(connectorName: DocId, scope: DocId, config: T): Promise; - removeConfig(connectorName: DocId, scope: DocId): Promise; -} -export {}; diff --git a/lib/connectors/config-management/index.js b/lib/connectors/config-management/index.js deleted file mode 100644 index dae842c..0000000 --- a/lib/connectors/config-management/index.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.configManagementConnector = void 0; -const framework_1 = require("../../framework"); -const t = __importStar(require("io-ts")); -const ramda_1 = __importDefault(require("ramda")); -const configManagementConnector = (connectors, repository) => framework_1.connector({ - getScope: () => new Context(connectors, repository), - scopeNameExample: null, - getScopeName: () => "", - getWarningMessage: async () => Promise.resolve(), - configSchema: t.null, - resources: { - blob: { - endpoints: { - import: () => ({ input }) => repository.import(input), - export: () => () => repository.export(), - }, - }, - connectors: { - endpoints: { - list: () => async function* () { - yield* Object.keys(connectors); - }, - }, - documents: { - idField: "name", - listIds: () => async function* () { - yield* ramda_1.default.keys(connectors); - }, - resources: { - scopes: { - endpoints: { - add: context => async ({ docId: [connectorName], input: scopeConfig }) => { - await context.addConfig(connectorName, scopeConfig); - }, - save: context => async ({ docId: [connectorName], input: scopeConfig }) => { - await context.setConfig(connectorName, scopeConfig); - }, - list: () => async function* ({ docId: [connectorName] }) { - const allScopes = await repository.getScopes(); - yield* allScopes - .filter(({ connector }) => connector === connectorName) - .map(({ scope }) => scope); - }, - }, - documents: { - idField: "name", - listIds: () => async function* (path) { - const [connectorName] = framework_1.Path.getDocIds(path); - yield* (await repository.getScopes()) - .filter(scope => scope.connector === connectorName && scope.scope !== null) - .map(scope => scope.scope); - }, - endpoints: { - delete: context => async ({ docId: [connector, scope] }) => { - return await context.removeConfig(connector, scope); - }, - get: context => async ({ docId: [connector, scope] }) => { - var _a; - return (_a = (await context.getConfig(connector, scope))) !== null && _a !== void 0 ? _a : null; - }, - update: context => async ({ docId: [connector, scope], input }) => { - return await context.updateConfig(connector, scope, input); - }, - }, - resources: { - fields: { - documents: { - idField: "path", - endpoints: { - delete: context => async ({ docId: [connector, scope, field] }) => { - return await context.updateConfig(connector, scope, existingConfig => { - return ramda_1.default.dissocPath(String(field).split("."), existingConfig); - }); - }, - get: context => async ({ docId: [connector, scope, field] }) => { - const config = await context.getConfig(connector, scope); - return ramda_1.default.path(String(field).split("."), config); - }, - set: context => async ({ docId: [connector, scope, field], input }) => { - return await context.updateConfig(connector, scope, existingConfig => { - return ramda_1.default.assocPath(String(field).split("."), input, existingConfig); - }); - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, -}); -exports.configManagementConnector = configManagementConnector; -class Context { - constructor(connectors, repository) { - this.connectors = connectors; - this.repository = repository; - } - validateConnectorName(name) { - this.connector(name); - } - connector(name) { - if (!(name in this.connectors)) { - throw new framework_1.EndpointError(`No such connector ${name}. Available connectors: ${ramda_1.default.keys(this.connectors).join(", ")}`); - } - return this.connectors[name]; - } - scope(connector, scope) { - this.validateConnectorName(connector); - return { connector: connector, scope: scope }; - } - async getConfig(connectorName, scope) { - this.validateConnectorName(connectorName); - return await this.repository.getConfig({ - connector: connectorName, - scope: scope, - }); - } - async addConfig(connectorName, config) { - const connector = this.connector(connectorName); - const scope = connector(config).scopeName; - const existingConfig = await this.getConfig(connectorName, scope); - if (existingConfig) { - throw new framework_1.EndpointError(`Connector ${connectorName} already has a scope named ${scope}.`); - } - await this.repository.setConfig({ connector: connectorName, scope }, config); - } - async setConfig(connectorName, config) { - const connector = this.connector(connectorName); - const scope = connector(config).scopeName; - await this.repository.setConfig({ connector: connectorName, scope }, config); - } - async updateConfig(connectorName, scope, fnOrConfig) { - const connector = this.connector(connectorName); - const existingConfig = await this.repository.getConfig({ - connector: connectorName, - scope: scope, - }); - if (!existingConfig) { - throw new framework_1.EndpointError(`Connector ${connector} does not have any scope named ${scope}.`); - } - const updatedConfig = typeof fnOrConfig === "function" ? fnOrConfig(existingConfig) : fnOrConfig; - const newScope = connector(updatedConfig).scopeName; - await this.repository.setConfig({ connector: connectorName, scope: newScope }, updatedConfig); - if (newScope !== scope) { - this.repository.removeConfig({ connector: connectorName, scope: scope }); - } - return updatedConfig; - } - async removeConfig(connectorName, scope) { - this.validateConnectorName(connectorName); - await this.repository.removeConfig({ - connector: connectorName, - scope: scope, - }); - } -} diff --git a/lib/connectors/index.d.ts b/lib/connectors/index.d.ts deleted file mode 100644 index eff258b..0000000 --- a/lib/connectors/index.d.ts +++ /dev/null @@ -1,1873 +0,0 @@ -export * from "./big-commerce"; -export * from "./config-management"; -export * from "./magento1"; -export * from "./magento2"; -export * from "./shopify"; -export * from "./bundle-b2b"; -export declare const regularConnectors: { - bigCommerce: import("..").Connector<{ - storeAlias: string; - storeHash: string; - credentials: { - clientId: string; - accessToken: string; - }; - }, import("./big-commerce/client").default, { - blog: { - resources: { - posts: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - tags: { - endpoints: { - list: import("..").EndpointDefinition; - }; - }; - }; - }; - brands: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - image: { - endpoints: { - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - }; - }; - metafields: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - carts: { - endpoints: { - create: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - resources: { - items: { - endpoints: { - create: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }; - }; - }; - categories: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap & { - tree: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - }, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - image: { - endpoints: { - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - }; - }; - metafields: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - channels: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - customers: import("..").ResourceDefinition; - delete: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap & { - addresses: { - endpoints: { - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - }; - }; - }; - attributes: import("..").ResourceDefinition; - delete: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap & { - values: { - endpoints: { - delete: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - upsert: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - delete: import("..").EndpointDefinition; - }; - }; - }; - }, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - }; - } & { - resources: { - values: { - endpoints: { - list: import("..").EndpointDefinition; - }; - }; - }; - }>; - formFieldValues: { - endpoints: { - list: import("..").EndpointDefinition; - upsert: import("..").EndpointDefinition; - }; - }; - customerGroups: { - endpoints: { - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }; - }; - subscribers: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - }; - } & import("..").DocumentDefinition>; - giftCertificates: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - orders: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap & { - statuses: { - endpoints: { - list: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - }; - }, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - refunds: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - shippingAddresses: { - documents: { - endpoints: { - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - endpoints: { - list: import("..").EndpointDefinition; - }; - }; - products: { - endpoints: { - list: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - }; - coupons: { - endpoints: { - list: import("..").EndpointDefinition; - }; - }; - shipments: { - endpoints: { - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - }; - }; - }; - metafields: { - endpoints: { - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - pages: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - paymentMethods: { - endpoints: { - list: import("..").EndpointDefinition; - }; - }; - priceLists: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap & { - assignments: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - }; - }; - }, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - records: { - endpoints: { - list: import("..").EndpointDefinition; - upsert: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - }; - }; - }; - }>; - products: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & { - update: import("..").EndpointDefinition; - }, import("..").ResourceDefinitionMap & { - variants: { - endpoints: { - list: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - channelAssignments: { - endpoints: { - list: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - bulkPricingRules: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - complexRules: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - customFields: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - images: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - metafields: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - modifiers: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - values: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - image: { - endpoints: { - create: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - delete: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - }; - }>; - options: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - values: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - reviews: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - variants: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - metafields: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - videos: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - promotions: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - codes: { - endpoints: { - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - delete: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - store: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - widgets: { - endpoints: { - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - resources: { - regions: { - endpoints: { - list: import("..").EndpointDefinition; - }; - }; - templates: { - endpoints: { - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - placements: { - endpoints: { - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }; - }; - wishlists: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./big-commerce/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - items: { - endpoints: { - create: import("..").EndpointDefinition; - }; - documents: { - endpoints: { - delete: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - }>; - magento1: import("..").Connector<{ - baseUrl: string; - } & { - concurrency?: number | undefined; - insecure?: boolean | undefined; - } & { - rest?: { - credentials: { - key: string; - secret: string; - }; - accessToken: { - token: string; - tokenSecret: string; - }; - } | undefined; - soap?: { - credentials: { - username: string; - apiKey: string; - }; - } | undefined; - }, { - rest: import("./magento1/rest").Magento1RestClient; - soap: import("./magento1/soap").Magento1SoapClient; - }, { - categories: { - documents: { - idField: string; - listIds: ({ soap }: import("./magento1/functions").Magento1Scope) => () => AsyncGenerator; - endpoints: { - getSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => ({ docId: [categoryId] }: import("..").EndpointPayload) => Promise; - }; - }; - resources: { - tree: { - endpoints: { - getSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => () => Promise; - }; - }; - }; - endpoints: { - listSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => () => AsyncGenerator; - }; - }; - customers: import("..").ResourceDefinition; - listRest: import("..").EndpointDefinition; - } & { - listSoap: import("..").EndpointDefinition; - }, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (scope: import("./magento1/functions").Magento1Scope) => (path: import("..").Path) => AsyncIterable; - endpoints: { - deleteRest: import("..").EndpointDefinition; - getRest: import("..").EndpointDefinition; - updateRest: import("..").EndpointDefinition; - }; - resources: { - addresses: import("..").ResourceDefinition; - }, import("..").ResourceDefinitionMap, import("..").DocumentDefinition>; - }; - } & { - resources: { - addresses: { - endpoints: { - getSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => ({ docId: [customerId] }: import("..").EndpointPayload) => Promise; - }; - }; - }; - endpoints: { - getSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => ({ docId: [customerId] }: import("..").EndpointPayload) => Promise; - }; - }>; - orders: import("..").ResourceDefinition; - } & { - listSoap: import("..").EndpointDefinition; - }, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (scope: import("./magento1/functions").Magento1Scope) => (path: import("..").Path) => AsyncIterable; - endpoints: { - getRest: import("..").EndpointDefinition; - }; - resources: { - items: import("..").ResourceDefinition; - }, import("..").ResourceDefinitionMap, import("..").DocumentDefinition>; - addresses: import("..").ResourceDefinition; - }, import("..").ResourceDefinitionMap, import("..").DocumentDefinition>; - comments: import("..").ResourceDefinition; - }, import("..").ResourceDefinitionMap, import("..").DocumentDefinition>; - }; - } & import("..").DocumentDefinition>; - products: import("..").ResourceDefinition; - listRest: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap & { - attributes: { - endpoints: { - listSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => (arg: import("..").EndpointPayload) => AsyncIterable; - }; - documents: { - idField: string; - listIds: ({ soap }: import("./magento1/functions").Magento1Scope) => (arg: import("..").Path) => AsyncIterable; - endpoints: { - getSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => ({ docId: [attribute] }: import("..").EndpointPayload) => Promise; - }; - }; - }; - attributeSets: { - endpoints: { - listSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => () => AsyncGenerator; - }; - documents: { - idField: string; - listIds: ({ soap }: import("./magento1/functions").Magento1Scope) => () => AsyncGenerator; - resources: { - attributes: { - endpoints: { - listSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => ({ docId: [setId] }: import("..").EndpointPayload) => AsyncGenerator; - }; - }; - }; - }; - }; - }, { - idField: string; - listIds: (scope: import("./magento1/functions").Magento1Scope) => (path: import("..").Path) => AsyncIterable; - endpoints: { - deleteRest: import("..").EndpointDefinition; - getRest: import("..").EndpointDefinition; - updateRest: import("..").EndpointDefinition; - }; - resources: { - categories: import("..").ResourceDefinition; - }, import("..").ResourceDefinitionMap, import("..").DocumentDefinition>; - images: import("..").ResourceDefinition; - }, import("..").ResourceDefinitionMap, import("..").DocumentDefinition>; - websites: import("..").ResourceDefinition; - }, import("..").ResourceDefinitionMap, import("..").DocumentDefinition>; - }; - } & { - resources: { - links: { - documents: { - idField: string; - endpoints: { - getSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => ({ docId: [product, type] }: import("..").EndpointPayload) => Promise; - }; - }; - }; - media: { - endpoints: { - getSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => ({ docId: [productId] }: import("..").EndpointPayload) => Promise; - }; - }; - }; - endpoints: { - getSoap: ({ soap }: import("./magento1/functions").Magento1Scope) => ({ docId: [productId] }: import("..").EndpointPayload) => Promise; - }; - }>; - }>; - magento2: import("..").Connector<{ - baseUrl: string; - } & { - storeView?: string | undefined; - concurrency?: number | undefined; - credentials?: { - username: string; - password: string; - } | undefined; - insecure?: boolean | undefined; - token?: { - value: string; - expiration: string; - } | undefined; - }, import("./magento2/client").default, { - categories: import("..").ResourceDefinition; - createAsync: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap & { - tree: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - }, { - idField: string; - listIds: (client: import("./magento2/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & import("..").DocumentDefinition>; - customers: { - endpoints: { - create: import("..").EndpointDefinition; - createAsync: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./magento2/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - orders: { - endpoints: { - list: import("..").EndpointDefinition; - }; - documents: Pick<{ - idField: string; - listIds: (client: import("./magento2/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }, "endpoints" | "idField" | "listIds">; - }; - products: import("..").ResourceDefinition; - createAsync: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap & { - attributes: import("..").ResourceDefinition; - createAsync: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./magento2/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - idField: string; - resources: { - options: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - }; - }>; - attributeGroups: { - endpoints: { - create: import("..").EndpointDefinition; - createAsync: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./magento2/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - attributeSets: import("..").ResourceDefinition; - createAsync: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - } & import("..").EndpointDefinitionMap, import("..").ResourceDefinitionMap, { - idField: string; - listIds: (client: import("./magento2/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - attributes: { - documents: { - idField: string; - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - }; - }; - }; - groups: { - endpoints: { - put: import("..").EndpointDefinition; - }; - }; - }; - }>; - configurables: { - documents: { - idField: string; - resources: { - children: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - options: { - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - }; - }; - }; - }, { - idField: string; - listIds: (client: import("./magento2/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - } & { - resources: { - links: { - documents: { - idField: string; - endpoints: { - get: import("..").EndpointDefinition; - }; - }; - }; - }; - }>; - }>; - shopify: import("..").Connector<{ - shopName: string; - credentials: { - apiKey: string; - password: string; - }; - }, import("./shopify/client").Scope, { - location: import("..").ResourceDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - inventoryLevels: import("..").EndpointDefinition; - }; - }>; - comment: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - spam: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - notSpam: import("..").EndpointDefinition; - approve: import("..").EndpointDefinition; - remove: import("..").EndpointDefinition; - restore: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - spam: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - notSpam: import("..").EndpointDefinition; - approve: import("..").EndpointDefinition; - remove: import("..").EndpointDefinition; - restore: import("..").EndpointDefinition; - }; - }>; - product: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - resources: { - productImage: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - productVariant: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - productResourceFeedback: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - customer: import("..").ResourceDefinition | import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - accountActivationUrl: import("..").EndpointDefinition | import("..").EndpointDefinition; - }, Record, { - resources: { - customerAddress: import("..").ResourceDefinition | import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - default: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - search: import("..").EndpointDefinition | import("..").EndpointDefinition; - orders: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - accountActivationUrl: import("..").EndpointDefinition | import("..").EndpointDefinition; - }; - }>; - dispute: import("..").ResourceDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - }; - }>; - payout: import("..").ResourceDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - }; - }>; - collection: import("..").ResourceDefinition, { - endpoints: { - get: import("..").EndpointDefinition; - products: import("..").EndpointDefinition; - }; - }>; - page: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - shop: import("..").ResourceDefinition, { - endpoints: { - get: import("..").EndpointDefinition; - }; - }>; - checkout: import("..").ResourceDefinition; - complete: import("..").EndpointDefinition | import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - shippingRates: import("..").EndpointDefinition | import("..").EndpointDefinition; - }, Record, { - resources: { - payment: import("..").ResourceDefinition | import("..").EndpointDefinition; - list: import("..").EndpointDefinition | import("..").EndpointDefinition; - create: import("..").EndpointDefinition | import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition | import("..").EndpointDefinition; - list: import("..").EndpointDefinition | import("..").EndpointDefinition; - create: import("..").EndpointDefinition | import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - complete: import("..").EndpointDefinition | import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - shippingRates: import("..").EndpointDefinition | import("..").EndpointDefinition; - }; - }>; - order: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - resources: { - refund: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - calculate: import("..").EndpointDefinition | import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - }; - }>; - fulfillment: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - updateTracking: import("..").EndpointDefinition; - }, Record, { - resources: { - fulfillmentEvent: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - open: import("..").EndpointDefinition; - complete: import("..").EndpointDefinition; - cancel: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - createV2: import("..").EndpointDefinition; - updateTracking: import("..").EndpointDefinition; - }; - }>; - orderRisk: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - transaction: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - close: import("..").EndpointDefinition; - open: import("..").EndpointDefinition; - cancel: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition | import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - fulfillmentOrders: import("..").EndpointDefinition; - }; - }>; - accessScope: import("..").ResourceDefinition; - }, Record, {}>; - apiPermission: import("..").ResourceDefinition, { - endpoints: { - delete: import("..").EndpointDefinition; - }; - }>; - applicationCharge: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - activate: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - activate: import("..").EndpointDefinition; - }; - }>; - applicationCredit: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - }; - }>; - balance: import("..").ResourceDefinition; - transactions: import("..").EndpointDefinition; - }, Record, { - endpoints: { - transactions: import("..").EndpointDefinition; - }; - }>; - blog: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - resources: { - article: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - authors: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - authors: import("..").EndpointDefinition; - tags: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - carrierService: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - collect: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - }; - }>; - collectionListing: import("..").ResourceDefinition; - productIds: import("..").EndpointDefinition | import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - productIds: import("..").EndpointDefinition | import("..").EndpointDefinition; - }; - }>; - country: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - resources: { - province: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - currency: import("..").ResourceDefinition; - }, Record, {}>; - customCollection: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - customerSavedSearch: import("..").ResourceDefinition; - customers: import("..").EndpointDefinition | import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - customers: import("..").EndpointDefinition | import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - draftOrder: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - complete: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - sendInvoice: import("..").EndpointDefinition | import("..").EndpointDefinition; - }; - }>; - fulfillmentEvent: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - fulfillmentOrder: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - move: import("..").EndpointDefinition; - cancel: import("..").EndpointDefinition; - locationsForMove: import("..").EndpointDefinition; - }, Record, { - resources: { - cancellationRequest: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - accept: import("..").EndpointDefinition; - }, Record, { - endpoints: { - reject: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - accept: import("..").EndpointDefinition; - }; - }>; - fulfillmentRequest: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - accept: import("..").EndpointDefinition; - }, Record, { - endpoints: { - reject: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - accept: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - close: import("..").EndpointDefinition; - move: import("..").EndpointDefinition; - cancel: import("..").EndpointDefinition; - locationsForMove: import("..").EndpointDefinition; - }; - }>; - fulfillmentService: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - giftCard: import("..").ResourceDefinition | import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - resources: { - giftCardAdjustment: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - search: import("..").EndpointDefinition | import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - disable: import("..").EndpointDefinition | import("..").EndpointDefinition; - }; - }>; - inventoryItem: import("..").ResourceDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - inventoryLevel: import("..").ResourceDefinition; - connect: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - adjust: import("..").EndpointDefinition; - }, Record, { - endpoints: { - connect: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - adjust: import("..").EndpointDefinition; - }; - }>; - marketingEvent: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - engagements: import("..").EndpointDefinition | import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - engagements: import("..").EndpointDefinition | import("..").EndpointDefinition; - }; - }>; - metafield: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - policy: import("..").ResourceDefinition; - }, Record, {}>; - priceRule: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - resources: { - discountCodeCreationJob: import("..").ResourceDefinition; - discountCodes: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - discountCodes: import("..").EndpointDefinition; - }; - }>; - discountCode: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - productListing: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - productIds: import("..").EndpointDefinition | import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - productIds: import("..").EndpointDefinition | import("..").EndpointDefinition; - }; - }>; - resourceFeedback: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, {}>; - recurringApplicationCharge: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - activate: import("..").EndpointDefinition; - customize: import("..").EndpointDefinition; - }, Record, { - resources: { - usageCharge: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - activate: import("..").EndpointDefinition; - customize: import("..").EndpointDefinition; - }; - }>; - redirect: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - report: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - scriptTag: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - shippingZone: import("..").ResourceDefinition; - }, Record, {}>; - smartCollection: import("..").ResourceDefinition; - products: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - order: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - products: import("..").EndpointDefinition; - order: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - storefrontAccessToken: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - endpoints: { - delete: import("..").EndpointDefinition; - }; - }>; - tenderTransaction: import("..").ResourceDefinition; - }, Record, {}>; - theme: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - }, Record, { - resources: { - asset: import("..").ResourceDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - create: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - user: import("..").ResourceDefinition; - current: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - }; - }>; - webhook: import("..").ResourceDefinition; - create: import("..").EndpointDefinition; - count: import("..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("..").EndpointDefinition; - delete: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }>; - }>; - bundleB2b: import("..").Connector<{ - storeAlias: string; - storeHash: string; - credentials: { - email: string; - password: string; - }; - } & { - token?: { - value: string; - expiration: number; - } | undefined; - }, import("./bundle-b2b/client").default, { - companies: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./bundle-b2b/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - users: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./bundle-b2b/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - addresses: { - endpoints: { - create: import("..").EndpointDefinition; - list: import("..").EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: import("./bundle-b2b/client").default) => (path: import("..").Path) => AsyncIterable; - endpoints: { - delete: import("..").EndpointDefinition; - get: import("..").EndpointDefinition; - update: import("..").EndpointDefinition; - }; - }; - }; - }>; -}; diff --git a/lib/connectors/index.js b/lib/connectors/index.js deleted file mode 100644 index 2564dfe..0000000 --- a/lib/connectors/index.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.regularConnectors = void 0; -const big_commerce_1 = require("./big-commerce"); -const magento1_1 = require("./magento1"); -const magento2_1 = require("./magento2"); -const shopify_1 = require("./shopify"); -const bundle_b2b_1 = require("./bundle-b2b"); -__exportStar(require("./big-commerce"), exports); -__exportStar(require("./config-management"), exports); -__exportStar(require("./magento1"), exports); -__exportStar(require("./magento2"), exports); -__exportStar(require("./shopify"), exports); -__exportStar(require("./bundle-b2b"), exports); -exports.regularConnectors = { - bigCommerce: big_commerce_1.bigCommerce, - magento1: magento1_1.magento1, - magento2: magento2_1.magento2, - shopify: shopify_1.shopify, - bundleB2b: bundle_b2b_1.bundleB2b, -}; diff --git a/lib/connectors/magento1/functions.d.ts b/lib/connectors/magento1/functions.d.ts deleted file mode 100644 index a3d3256..0000000 --- a/lib/connectors/magento1/functions.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Magento1RestClient } from "./rest"; -import { EndpointDefinition, Path, ResourceDefinition } from "../../framework"; -import { Magento1SoapClient } from "./soap"; -export declare type Magento1Scope = { - rest: Magento1RestClient; - soap: Magento1SoapClient; -}; -export declare class Soap { - private constructor(); - static list(method: string): EndpointDefinition; - private static prepareFilters; -} -declare type Children = { - [K in Name]: ResourceDefinition; - }>; -}; -export declare class Rest { - private constructor(); - static crud(uriPattern: string, childNames?: readonly ChildName[]): { - endpoints: { - createRest: EndpointDefinition; - listRest: EndpointDefinition; - }; - documents: { - idField: string; - listIds: (scope: Magento1Scope) => (path: Path) => AsyncIterable; - endpoints: { - deleteRest: EndpointDefinition; - getRest: EndpointDefinition; - updateRest: EndpointDefinition; - }; - resources: Children; - }; - }; - static read(uriPattern: string, childNames?: readonly ChildName[]): { - endpoints: { - listRest: EndpointDefinition; - }; - documents: { - idField: string; - listIds: (scope: Magento1Scope) => (path: Path) => AsyncIterable; - endpoints: { - getRest: EndpointDefinition; - }; - resources: Children; - }; - }; - private static children; - private static fn; - static create: (uriPattern: string) => EndpointDefinition; - static del: (uriPattern: string) => EndpointDefinition; - static get: (uriPattern: string) => EndpointDefinition; - static list: (uriPattern: string) => EndpointDefinition; - static update: (uriPattern: string) => EndpointDefinition; - private static listIds; -} -export declare function useAgent(fn: () => Promise): Promise; -export {}; diff --git a/lib/connectors/magento1/functions.js b/lib/connectors/magento1/functions.js deleted file mode 100644 index 6ecf41e..0000000 --- a/lib/connectors/magento1/functions.js +++ /dev/null @@ -1,135 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.useAgent = exports.Rest = exports.Soap = void 0; -const json_pipe_1 = require("@space48/json-pipe"); -const framework_1 = require("../../framework"); -const ramda_1 = __importDefault(require("ramda")); -class Soap { - constructor() { - return; - } - static list(method) { - return ({ soap }) => async function* ({ input: filters }) { - const result = await soap.execute(method, { - filters: Soap.prepareFilters(filters), - }); - if (result !== null) { - yield* result; - } - }; - } - static prepareFilters(restStyleFilters) { - return { - complex_filter: { - complexObjectArray: restStyleFilters.map(filter => { - if (!(Array.isArray(filter) && filter.length === 3)) { - throw new Error("Filters must of format [field, condition, value]"); - } - return { key: filter[0], value: { key: filter[1], value: filter[2] } }; - }), - }, - }; - } -} -exports.Soap = Soap; -class Rest { - constructor() { - return; - } - static crud(uriPattern, childNames = []) { - const docUriPattern = `${uriPattern}/{id}`; - return { - endpoints: { - createRest: Rest.create(uriPattern), - listRest: Rest.list(uriPattern), - }, - documents: { - idField: "entity_id", - listIds: Rest.listIds(uriPattern), - endpoints: { - deleteRest: Rest.del(docUriPattern), - getRest: Rest.get(docUriPattern), - updateRest: Rest.update(docUriPattern), - }, - resources: Rest.children(docUriPattern, childNames), - }, - }; - } - static read(uriPattern, childNames = []) { - const docUriPattern = `${uriPattern}/{id}`; - return { - endpoints: { - listRest: Rest.list(uriPattern), - }, - documents: { - idField: "entity_id", - listIds: Rest.listIds(uriPattern), - endpoints: { - getRest: Rest.get(docUriPattern), - }, - resources: Rest.children(docUriPattern, childNames), - }, - }; - } - static children(parentUri, children) { - return ramda_1.default.fromPairs(children.map(childName => ramda_1.default.pair(childName, framework_1.resource({ - endpoints: { - getRest: Rest.get(`${parentUri}/childName`), - }, - })))); - } - static fn(uriPattern, _fn) { - return ({ rest }) => ({ path, input }) => { - const uri = UriTemplate.uri(uriPattern, framework_1.Path.getDocIds(path)); - return _fn(rest, uri, input, framework_1.Path.getDocIds(path)); - }; - } - static listIds(uriPattern) { - return (scope) => (path) => { - const uri = UriTemplate.uri(uriPattern, framework_1.Path.getDocIds(path)); - const docs = scope.rest.search(uri, { sortKey: "entity_id" }); - return json_pipe_1.pipe(docs, json_pipe_1.map(doc => doc.entity_id)); - }; - } -} -exports.Rest = Rest; -Rest.create = (uriPattern) => Rest.fn(uriPattern, (m2Client, uri, data) => m2Client.post(uri, data)); -Rest.del = (uriPattern) => Rest.fn(uriPattern, (m2Client, uri, data) => m2Client.delete(uri, data)); -Rest.get = (uriPattern) => Rest.fn(uriPattern, (m2Client, uri) => m2Client.get(uri)); -Rest.list = (uriPattern) => Rest.fn(uriPattern, (m2Client, uri, filters) => m2Client.search(uri, { sortKey: "entity_id", filters })); -Rest.update = (uriPattern) => Rest.fn(uriPattern, (m2Client, uri, data) => m2Client.put(uri, data)); -async function useAgent(fn) { - try { - return await fn(); - } - catch (e) { - if (e instanceof Error && e.message.includes("socket hang up")) { - return await fn(); - } - throw e; - } -} -exports.useAgent = useAgent; -class UriTemplate { - static uri(uriTemplate, fieldValues) { - const uri = UriTemplate.applyValues(uriTemplate, fieldValues); - const missingValues = UriTemplate.fields(uri); - if (UriTemplate.fields(uri).length > 0) { - throw new Error(`Missing URI fields ${missingValues.join(", ")}`); - } - return uri; - } - static applyValues(uriTemplate, fieldValues) { - return UriTemplate.fields(uriTemplate) - .filter((field, index) => { var _a; return ((_a = fieldValues[index]) !== null && _a !== void 0 ? _a : null) !== null; }) - .reduce((uri, field, index) => uri.replace(`{${field}}`, String(fieldValues[index])), uriTemplate); - } - static fields(uriTemplate) { - var _a; - // todo: convert to matchAll once we support ES2020 - return (((_a = uriTemplate.match(/\{[^}]+\}/g)) === null || _a === void 0 ? void 0 : _a.map(match => match.substring(1, match.length - 1))) || []); - } -} diff --git a/lib/connectors/magento1/index.d.ts b/lib/connectors/magento1/index.d.ts deleted file mode 100644 index 0258d8d..0000000 --- a/lib/connectors/magento1/index.d.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { Magento1Scope } from "./functions"; -import * as t from "io-ts"; -import { Magento1SoapClient } from "./soap"; -import { Magento1RestClient } from "./rest"; -import * as f from "../../framework"; -export declare type Magento1Config = t.TypeOf; -declare const configSchema: t.IntersectionC<[t.TypeC<{ - baseUrl: t.StringC; -}>, t.PartialC<{ - concurrency: t.NumberC; - insecure: t.BooleanC; -}>, t.PartialC<{ - rest: t.TypeC<{ - credentials: t.TypeC<{ - key: t.StringC; - secret: t.StringC; - }>; - accessToken: t.TypeC<{ - token: t.StringC; - tokenSecret: t.StringC; - }>; - }>; - soap: t.TypeC<{ - credentials: t.TypeC<{ - username: t.StringC; - apiKey: t.StringC; - }>; - }>; -}>]>; -export declare const magento1: f.Connector<{ - baseUrl: string; -} & { - concurrency?: number | undefined; - insecure?: boolean | undefined; -} & { - rest?: { - credentials: { - key: string; - secret: string; - }; - accessToken: { - token: string; - tokenSecret: string; - }; - } | undefined; - soap?: { - credentials: { - username: string; - apiKey: string; - }; - } | undefined; -}, { - rest: Magento1RestClient; - soap: Magento1SoapClient; -}, { - categories: { - documents: { - idField: string; - listIds: ({ soap }: Magento1Scope) => () => AsyncGenerator; - endpoints: { - getSoap: ({ soap }: Magento1Scope) => ({ docId: [categoryId] }: f.EndpointPayload) => Promise; - }; - }; - resources: { - tree: { - endpoints: { - getSoap: ({ soap }: Magento1Scope) => () => Promise; - }; - }; - }; - endpoints: { - listSoap: ({ soap }: Magento1Scope) => () => AsyncGenerator; - }; - }; - customers: f.ResourceDefinition; - listRest: f.EndpointDefinition; - } & { - listSoap: f.EndpointDefinition; - }, f.ResourceDefinitionMap, { - idField: string; - listIds: (scope: Magento1Scope) => (path: f.Path) => AsyncIterable; - endpoints: { - deleteRest: f.EndpointDefinition; - getRest: f.EndpointDefinition; - updateRest: f.EndpointDefinition; - }; - resources: { - addresses: f.ResourceDefinition; - }, f.ResourceDefinitionMap, f.DocumentDefinition>; - }; - } & { - resources: { - addresses: { - endpoints: { - getSoap: ({ soap }: Magento1Scope) => ({ docId: [customerId] }: f.EndpointPayload) => Promise; - }; - }; - }; - endpoints: { - getSoap: ({ soap }: Magento1Scope) => ({ docId: [customerId] }: f.EndpointPayload) => Promise; - }; - }>; - orders: f.ResourceDefinition; - } & { - listSoap: f.EndpointDefinition; - }, f.ResourceDefinitionMap, { - idField: string; - listIds: (scope: Magento1Scope) => (path: f.Path) => AsyncIterable; - endpoints: { - getRest: f.EndpointDefinition; - }; - resources: { - items: f.ResourceDefinition; - }, f.ResourceDefinitionMap, f.DocumentDefinition>; - addresses: f.ResourceDefinition; - }, f.ResourceDefinitionMap, f.DocumentDefinition>; - comments: f.ResourceDefinition; - }, f.ResourceDefinitionMap, f.DocumentDefinition>; - }; - } & f.DocumentDefinition>; - products: f.ResourceDefinition; - listRest: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap & { - attributes: { - endpoints: { - listSoap: ({ soap }: Magento1Scope) => (arg: f.EndpointPayload) => AsyncIterable; - }; - documents: { - idField: string; - listIds: ({ soap }: Magento1Scope) => (arg: f.Path) => AsyncIterable; - endpoints: { - getSoap: ({ soap }: Magento1Scope) => ({ docId: [attribute] }: f.EndpointPayload) => Promise; - }; - }; - }; - attributeSets: { - endpoints: { - listSoap: ({ soap }: Magento1Scope) => () => AsyncGenerator; - }; - documents: { - idField: string; - listIds: ({ soap }: Magento1Scope) => () => AsyncGenerator; - resources: { - attributes: { - endpoints: { - listSoap: ({ soap }: Magento1Scope) => ({ docId: [setId] }: f.EndpointPayload) => AsyncGenerator; - }; - }; - }; - }; - }; - }, { - idField: string; - listIds: (scope: Magento1Scope) => (path: f.Path) => AsyncIterable; - endpoints: { - deleteRest: f.EndpointDefinition; - getRest: f.EndpointDefinition; - updateRest: f.EndpointDefinition; - }; - resources: { - categories: f.ResourceDefinition; - }, f.ResourceDefinitionMap, f.DocumentDefinition>; - images: f.ResourceDefinition; - }, f.ResourceDefinitionMap, f.DocumentDefinition>; - websites: f.ResourceDefinition; - }, f.ResourceDefinitionMap, f.DocumentDefinition>; - }; - } & { - resources: { - links: { - documents: { - idField: string; - endpoints: { - getSoap: ({ soap }: Magento1Scope) => ({ docId: [product, type] }: f.EndpointPayload) => Promise; - }; - }; - }; - media: { - endpoints: { - getSoap: ({ soap }: Magento1Scope) => ({ docId: [productId] }: f.EndpointPayload) => Promise; - }; - }; - }; - endpoints: { - getSoap: ({ soap }: Magento1Scope) => ({ docId: [productId] }: f.EndpointPayload) => Promise; - }; - }>; -}>; -export {}; diff --git a/lib/connectors/magento1/index.js b/lib/connectors/magento1/index.js deleted file mode 100644 index 9e4938f..0000000 --- a/lib/connectors/magento1/index.js +++ /dev/null @@ -1,227 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.magento1 = void 0; -const framework_1 = require("../../framework"); -const functions_1 = require("./functions"); -const url_1 = require("url"); -const http_1 = require("http"); -const https_1 = require("https"); -const t = __importStar(require("io-ts")); -const soap_1 = require("./soap"); -const rest_1 = require("./rest"); -const json_pipe_1 = require("@space48/json-pipe"); -const configSchema = t.intersection([ - t.type({ - baseUrl: t.string, - }), - t.partial({ - concurrency: t.number, - insecure: t.boolean, - }), - t.partial({ - rest: rest_1.magento1RestConfigSchema, - soap: soap_1.magento1SoapConfigSchema, - }), -]); -const mergeResources = framework_1.resourceMerger(); -const defaultConcurrency = 3; -exports.magento1 = framework_1.connector({ - configSchema, - scopeNameExample: getScopeName("www.my-shop.com"), - getScopeName: config => getScopeName(config.baseUrl), - getScope: configRef => { - const agent = configRef - .map(config => { - var _a; - return ({ - protocol: url_1.parse(config.baseUrl).protocol, - insecure: config.insecure, - concurrency: (_a = config.concurrency) !== null && _a !== void 0 ? _a : defaultConcurrency, - }); - }) - .map(({ protocol, insecure, concurrency }) => protocol === "https:" - ? new https_1.Agent({ - rejectUnauthorized: !insecure, - keepAlive: true, - maxSockets: concurrency, - }) - : new http_1.Agent({ - keepAlive: true, - maxSockets: concurrency, - })); - const baseUrlRef = configRef.map(config => config.baseUrl); - const rest = new rest_1.Magento1RestClient(baseUrlRef, agent, configRef.map(config => config.rest)); - const soap = new soap_1.Magento1SoapClient(baseUrlRef, agent, configRef.map(config => config.soap)); - return { rest, soap }; - }, - getWarningMessage: async (scope) => Promise.resolve(), - resources: { - categories: { - documents: { - idField: "entity_id", - listIds: ({ soap }) => async function* () { - function* getCategoryIds(category) { - const { category_id, children } = category; - yield category_id; - for (const child of children !== null && children !== void 0 ? children : []) { - yield* getCategoryIds(child); - } - } - const root = await soap.execute("catalogCategoryTree"); - yield* getCategoryIds(root); - }, - endpoints: { - getSoap: ({ soap }) => ({ docId: [categoryId] }) => soap.execute("catalogCategoryInfo", { - categoryId, - storeView: "default", - }), - }, - }, - resources: { - tree: { - endpoints: { - getSoap: ({ soap }) => () => soap.execute("catalogCategoryTree"), - }, - }, - }, - endpoints: { - listSoap: ({ soap }) => async function* () { - function* getCategories(category) { - const { children, ...rest } = category; - yield rest; - for (const child of children !== null && children !== void 0 ? children : []) { - yield* getCategories(child); - } - } - const root = await soap.execute("catalogCategoryTree"); - yield* getCategories(root); - }, - }, - }, - customers: mergeResources(functions_1.Rest.crud("customers", ["addresses"]), { - documents: { - resources: { - addresses: { - endpoints: { - getSoap: ({ soap }) => ({ docId: [customerId] }) => soap.execute("customerAddressList", { customerId }), - }, - }, - }, - endpoints: { - getSoap: ({ soap }) => ({ docId: [customerId] }) => soap.execute("customerCustomerInfo", { customerId }), - }, - }, - endpoints: { - listSoap: functions_1.Soap.list("customerCustomerList"), - }, - }), - orders: mergeResources(functions_1.Rest.read("orders", ["addresses", "comments", "items"]), { - endpoints: { - listSoap: functions_1.Soap.list("salesOrderList"), - }, - }), - products: mergeResources(functions_1.Rest.crud("products", ["categories", "images", "websites"]), { - documents: { - resources: { - links: { - documents: { - idField: "type", - endpoints: { - getSoap: ({ soap }) => ({ docId: [product, type] }) => soap.execute("catalogProductLinkList", { product, type }), - }, - }, - }, - media: { - endpoints: { - getSoap: ({ soap }) => ({ docId: [productId] }) => soap.execute("catalogProductAttributeMediaList", { productId }), - }, - }, - }, - endpoints: { - getSoap: ({ soap }) => ({ docId: [productId] }) => soap.execute("catalogProductInfo", { productId }), - }, - }, - resources: { - attributes: { - endpoints: { - listSoap: ({ soap }) => json_pipe_1.compose(async function* () { - const result = await soap.execute("catalogProductAttributeSetList"); - yield* result !== null && result !== void 0 ? result : []; - }, json_pipe_1.map(attributeSet => attributeSet.set_id), json_pipe_1.flatMapAsync(async function* (setId) { - const result = await soap.execute("catalogProductAttributeList", { - setId, - }); - yield* result !== null && result !== void 0 ? result : []; - }), json_pipe_1.batch(Number.MAX_SAFE_INTEGER), json_pipe_1.flatMap(attributes => attributes.sort((attr1, attr2) => attr1.attribute_id - attr2.attribute_id)), json_pipe_1.distinct((attr1, attr2) => attr1.attribute_id === attr2.attribute_id)), - }, - documents: { - idField: "attribute_id", - listIds: ({ soap }) => json_pipe_1.compose(async function* () { - const result = await soap.execute("catalogProductAttributeSetList"); - yield* result !== null && result !== void 0 ? result : []; - }, json_pipe_1.map(attributeSet => attributeSet.set_id), json_pipe_1.flatMapAsync(async function* (setId) { - const result = await soap.execute("catalogProductAttributeList", { - setId, - }); - yield* result !== null && result !== void 0 ? result : []; - }), json_pipe_1.map(attribute => attribute.attribute_id), json_pipe_1.batch(Number.MAX_SAFE_INTEGER), json_pipe_1.flatMap(attributes => attributes.sort()), json_pipe_1.distinct()), - endpoints: { - getSoap: ({ soap }) => ({ docId: [attribute] }) => soap.execute("catalogProductAttributeInfo", { attribute }), - }, - }, - }, - attributeSets: { - endpoints: { - listSoap: ({ soap }) => async function* () { - const result = await soap.execute("catalogProductAttributeSetList"); - yield* result !== null && result !== void 0 ? result : []; - }, - }, - documents: { - idField: "attribute_set_id", - listIds: ({ soap }) => async function* () { - const result = await soap.execute("catalogProductAttributeSetList"); - const attributeSets = result !== null && result !== void 0 ? result : []; - yield* attributeSets.map(set => set.set_id); - }, - resources: { - attributes: { - endpoints: { - listSoap: ({ soap }) => async function* ({ docId: [setId] }) { - const result = await soap.execute("catalogProductAttributeList", { - setId, - }); - yield* result !== null && result !== void 0 ? result : []; - }, - }, - }, - }, - }, - }, - }, - }), - }, -}); -function getScopeName(storeBaseUrl) { - const { host, path } = url_1.parse(storeBaseUrl); - return `${host || ""}${path}`.replace(/\/$/, "").toLowerCase(); -} diff --git a/lib/connectors/magento1/rest.d.ts b/lib/connectors/magento1/rest.d.ts deleted file mode 100644 index 2ed6dcd..0000000 --- a/lib/connectors/magento1/rest.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// -import { Agent } from "http"; -import { Reference } from "../../framework"; -import * as t from "io-ts"; -export declare type Magento1RestConfig = t.TypeOf; -export declare const magento1RestConfigSchema: t.TypeC<{ - credentials: t.TypeC<{ - key: t.StringC; - secret: t.StringC; - }>; - accessToken: t.TypeC<{ - token: t.StringC; - tokenSecret: t.StringC; - }>; -}>; -export declare class Magento1RestClient { - private baseUrl; - private agent; - private config; - constructor(baseUrl: Reference, agent: Reference, config: Reference); - get(uri: string, params?: QueryParams): Promise; - search = any>(uri: string, { sortKey, filters }: { - sortKey: string; - filters?: Filter[]; - }): AsyncIterable; - private getFirstItemId; - private searchRange; - post(uri: string, content: any): Promise; - put(uri: string, content: any): Promise; - patch(uri: string, content: any): Promise; - delete(uri: string, content?: any): Promise; - private makeUnsafeRequest; - private fetch; - private init; - private authHeaderFn; -} -export declare type QueryParams = { - [param: string]: QueryParam; -}; -declare type QueryParam = QueryParams | string | number | QueryParam[]; -declare type FilterCondition = "eq" | "gt" | "gteq" | "lt" | "lteq" | "in"; -declare type Filter = [string, FilterCondition, string | number | string[] | number[]]; -export declare function getAccessToken(baseUrl: string, credentials: Magento1RestConfig["credentials"]): Promise; -export {}; diff --git a/lib/connectors/magento1/rest.js b/lib/connectors/magento1/rest.js deleted file mode 100644 index 69c67f3..0000000 --- a/lib/connectors/magento1/rest.js +++ /dev/null @@ -1,220 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getAccessToken = exports.Magento1RestClient = exports.magento1RestConfigSchema = void 0; -const node_fetch_1 = __importDefault(require("node-fetch")); -const query_string_1 = require("query-string"); -const open_1 = __importDefault(require("open")); -const oauth_1 = require("oauth"); -const rl = __importStar(require("readline")); -const framework_1 = require("../../framework"); -const t = __importStar(require("io-ts")); -const ramda_1 = __importDefault(require("ramda")); -const functions_1 = require("./functions"); -const json_pipe_1 = require("@space48/json-pipe"); -exports.magento1RestConfigSchema = t.type({ - credentials: t.type({ - key: t.string, - secret: t.string, - }), - accessToken: t.type({ - token: t.string, - tokenSecret: t.string, - }), -}); -class Magento1RestClient { - constructor(baseUrl, agent, config) { - this.baseUrl = baseUrl; - this.agent = agent; - this.config = config; - this.authHeaderFn = framework_1.Reference.combine({ baseUrl: this.baseUrl, rest: this.config }).map(({ baseUrl, rest }) => { - if (!rest) { - throw new Error("REST has not been configured."); - } - const client = getOauthClient(baseUrl, rest.credentials); - return (method, url) => client.authHeader(url, rest.accessToken.token, rest.accessToken.tokenSecret, method); - }); - } - async get(uri, params) { - const paramsFlattened = params && flattenParams(params); - const paramsString = paramsFlattened ? `?${query_string_1.stringify(paramsFlattened)}` : ""; - return await this.fetch(uri + paramsString); - } - async *search(uri, { sortKey, filters = [] }) { - const [minId, maxId] = await Promise.all([ - this.getFirstItemId(uri, { sortKey, filters }, "asc"), - this.getFirstItemId(uri, { sortKey, filters }, "desc"), - ]); - if (minId === null || maxId === null) { - return; - } - const maxNumShards = 100; - const pageSize = 100; - const maxPossibleNumItems = Number(maxId) - Number(minId) + 1; - const maxPossibleNumPages = Math.ceil(maxPossibleNumItems / pageSize); - const numShards = Math.min(maxNumShards, maxPossibleNumPages); - const idsPerShard = Math.ceil(maxPossibleNumItems / numShards); - const shardFilters = range(numShards).map(n => [ - [sortKey, "gteq", Number(minId) + idsPerShard * n], - [sortKey, "lt", Number(minId) + idsPerShard * (n + 1)], - ]); - const shards = shardFilters.map(filters => this.searchRange(uri, { sortKey, filters })); - yield* json_pipe_1.mergeUnordered(...shards); - } - async getFirstItemId(uri, { sortKey, filters = [] }, dir) { - const content = await this.get(uri, { - filter: filters.map(([attribute, conditionType, value]) => ({ - attribute, - [conditionType]: value, - })), - order: sortKey, - dir, - limit: 1, - }); - const items = Object.values(content); - if (items.length === 0) { - return null; - } - return items.slice(-1)[0][sortKey]; - } - async *searchRange(uri, { sortKey, filters = [] }) { - let additionalFilters = []; - while (1) { - const content = await this.get(uri, { - filter: [...filters, ...additionalFilters].map(([attribute, conditionType, value]) => ({ - attribute, - [conditionType]: value, - })), - order: sortKey, - dir: "asc", - limit: 100, - }); - const items = Object.values(content); - if (items.length === 0) { - break; - } - yield* items; - const lastId = items.slice(-1)[0][sortKey]; - additionalFilters = [[sortKey, "gt", lastId]]; - } - } - async post(uri, content) { - return this.makeUnsafeRequest("POST", uri, content); - } - async put(uri, content) { - return this.makeUnsafeRequest("PUT", uri, content); - } - async patch(uri, content) { - return this.makeUnsafeRequest("PATCH", uri, content); - } - async delete(uri, content) { - return this.makeUnsafeRequest("DELETE", uri, content); - } - async makeUnsafeRequest(method, uri, content) { - return await this.fetch(uri, { - method, - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(content), - }); - } - async fetch(relativeUri, init) { - return await functions_1.useAgent(async () => { - const url = `${this.baseUrl.get().replace(/\/+$/, "")}/api/rest/${relativeUri}`; - const auth = this.authHeaderFn.get()((init === null || init === void 0 ? void 0 : init.method) || "GET", url); - const response = await node_fetch_1.default(url, this.init({ auth, init })); - if (!response.ok) { - throw new Error(`${response.status} ${response.statusText}\n\n${await response.text()}`); - } - return await response.json(); - }); - } - init({ auth, init }) { - const headers = { - ...((init === null || init === void 0 ? void 0 : init.headers) || {}), - Authorization: auth, - Accept: "application/json", - }; - return { - ...(init || {}), - headers, - agent: this.agent.get(), - }; - } -} -exports.Magento1RestClient = Magento1RestClient; -const flattenParams = ramda_1.default.pipe((params) => ramda_1.default.toPairs(params), ramda_1.default.chain(([name, value]) => flattenParam(name, value)), pairs => ramda_1.default.fromPairs(pairs)); -function flattenParam(name, value) { - switch (typeof value) { - case "string": - return [[name, value]]; - case "number": - return [[name, value.toString()]]; - case "object": { - const entries = Array.isArray(value) - ? value.map((_value, index) => [index + 1, _value]) - : Object.entries(value); - return ramda_1.default.chain(([_name, _value]) => flattenParam(`${name}[${_name}]`, _value), entries); - } - case "undefined": - return []; - } -} -async function getAccessToken(baseUrl, credentials) { - const oauth = getOauthClient(baseUrl, credentials); - const { token, tokenSecret } = await new Promise((resolve, reject) => { - oauth.getOAuthRequestToken({ oauth_callback: "oob" }, (error, token, tokenSecret) => { - if (error) { - reject(error); - } - else { - resolve({ token, tokenSecret }); - } - }); - }); - await open_1.default(`${baseUrl}/admin/oauth_authorize?oauth_token=${token}`); - const readLine = rl.createInterface({ - input: process.stdin, - output: process.stdout, - }); - const verifierCode = await new Promise(resolve => readLine.question("Verifier code: ", resolve)); - readLine.close(); - return await new Promise((resolve, reject) => { - oauth.getOAuthAccessToken(token, tokenSecret, verifierCode, (error, token, tokenSecret) => { - if (error) { - reject(error); - } - else { - resolve({ token, tokenSecret }); - } - }); - }); -} -exports.getAccessToken = getAccessToken; -function getOauthClient(baseUrl, credentials) { - return new oauth_1.OAuth(`${baseUrl}/oauth/initiate`, `${baseUrl}/oauth/token`, credentials.key, credentials.secret, "1.0", // not 1.0a as per Magento docs - null, "HMAC-SHA1"); -} -const range = (n) => Array.from(Array(n).keys()); diff --git a/lib/connectors/magento1/soap.d.ts b/lib/connectors/magento1/soap.d.ts deleted file mode 100644 index 056d004..0000000 --- a/lib/connectors/magento1/soap.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// -import * as t from "io-ts"; -import { Reference } from "../../framework"; -import { Agent } from "http"; -export declare type Magento1SoapConfig = t.TypeOf; -export declare const magento1SoapConfigSchema: t.TypeC<{ - credentials: t.TypeC<{ - username: t.StringC; - apiKey: t.StringC; - }>; -}>; -export declare class Magento1SoapClient { - private baseUrl; - private agent; - private soapConfig; - constructor(baseUrl: Reference, agent: Reference, soapConfig: Reference); - execute(method: string, args?: Record): Promise; - private client; - private state; -} diff --git a/lib/connectors/magento1/soap.js b/lib/connectors/magento1/soap.js deleted file mode 100644 index 0ec9e69..0000000 --- a/lib/connectors/magento1/soap.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Magento1SoapClient = exports.magento1SoapConfigSchema = void 0; -const soap_1 = require("soap"); -const t = __importStar(require("io-ts")); -const ramda_1 = __importDefault(require("ramda")); -const framework_1 = require("../../framework"); -const functions_1 = require("./functions"); -exports.magento1SoapConfigSchema = t.type({ - credentials: t.type({ - username: t.string, - apiKey: t.string, - }), -}); -class Magento1SoapClient { - constructor(baseUrl, agent, soapConfig) { - this.baseUrl = baseUrl; - this.agent = agent; - this.soapConfig = soapConfig; - this.client = this.baseUrl.map(baseUrl => soap_1.createClientAsync(`${baseUrl}/api/v2_soap?wsdl=1`, { - ignoredNamespaces: ["xsi"], - wsdl_options: { agentOptions: { rejectUnauthorized: false } }, - })); - this.state = framework_1.Reference.combine({ - soap: this.soapConfig, - agent: this.agent, - clientPromise: this.client, - }).map(({ soap, agent, clientPromise }) => { - if (!soap) { - return; - } - const requestOptions = { agent }; - const loginResult = clientPromise - .then(client => client.loginAsync(soap.credentials, requestOptions)) - .then(([result]) => result.result - ? { wsiCompliance: true, sessionId: result.result } - : { wsiCompliance: false, sessionId: extractNonWsiValue(result.loginReturn) }); - return { - requestOptions, - clientPromise, - loginResult, - }; - }); - } - async execute(method, args = {}) { - const state = this.state.get(); - if (!state) { - throw new Error("Soap has not been configured."); - } - const { clientPromise, loginResult, requestOptions } = state; - const client = await clientPromise; - const { sessionId, wsiCompliance } = await loginResult; - const [result] = await functions_1.useAgent(() => client[`${method}Async`]({ sessionId, ...args }, requestOptions)); - return wsiCompliance - ? extractWsiValue(result.result) - : extractNonWsiValue(Object.values(result)[0]); - } -} -exports.Magento1SoapClient = Magento1SoapClient; -function extractWsiValue(result) { - if (result === null || typeof result !== "object") { - return result; - } - if (result.complexObjectArray) { - return result.complexObjectArray.map(extractWsiValue); - } - return ramda_1.default.mapObjIndexed(extractWsiValue, result); -} -function extractNonWsiValue(result) { - var _a; - if (result.$value !== undefined) { - return extractNonWsiValue(result.$value); - } - if ((_a = result.attributes) === null || _a === void 0 ? void 0 : _a["SOAP-ENC:arrayType"]) { - const items = !result.item ? [] : Array.isArray(result.item) ? result.item : [result.item]; - return items.map(extractNonWsiValue); - } - if (typeof result === "object") { - if (result === null) { - return null; - } - const mapped = ramda_1.default.mapObjIndexed(extractNonWsiValue, result); - delete mapped.attributes; - return mapped; - } - return result; -} diff --git a/lib/connectors/magento2/client.d.ts b/lib/connectors/magento2/client.d.ts deleted file mode 100644 index e41bef5..0000000 --- a/lib/connectors/magento2/client.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { MutableReference } from "../../framework"; -import * as t from "io-ts"; -export declare type Config = t.TypeOf; -export declare const configSchema: t.IntersectionC<[t.TypeC<{ - baseUrl: t.StringC; -}>, t.PartialC<{ - storeView: t.StringC; - concurrency: t.NumberC; - credentials: t.TypeC<{ - username: t.StringC; - password: t.StringC; - }>; - insecure: t.BooleanC; - token: t.TypeC<{ - value: t.StringC; - expiration: t.StringC; - }>; -}>]>; -export default class Magento2 { - private readonly config; - constructor(config: MutableReference); - get(uri: string, params?: QueryParams): Promise; - search = any>(uri: string, { sortKey, filters }: { - sortKey: SortKey; - filters?: Filter[]; - }): AsyncIterable; - post(uri: string, content: any, fetchAsynchronously?: boolean): Promise; - put(uri: string, content: any, fetchAsynchronously?: boolean): Promise; - patch(uri: string, content: any): Promise; - delete(uri: string, content?: any): Promise; - private fetchSearchResultsPage; - private fetch; - private refreshToken; - private getToken; - private readonly agent; -} -export declare type QueryParams = { - [param: string]: QueryParam; -}; -declare type QueryParam = QueryParams | string | number | QueryParam[]; -export declare type Filter = [string, FilterCondition, string | number | Array]; -declare type FilterCondition = "eq" | "finset" | "from" | "gt" | "gteq" | "in" | "like" | "lt" | "lteq" | "moreq" | "neq" | "nfinset" | "nin" | "notnull" | "null" | "to"; -export declare type SortKey = { - query: string; - response: string; -}; -export {}; diff --git a/lib/connectors/magento2/client.js b/lib/connectors/magento2/client.js deleted file mode 100644 index 63e8963..0000000 --- a/lib/connectors/magento2/client.js +++ /dev/null @@ -1,206 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.configSchema = void 0; -const node_fetch_1 = __importDefault(require("node-fetch")); -const query_string_1 = require("query-string"); -const framework_1 = require("../../framework"); -const t = __importStar(require("io-ts")); -const http_1 = require("http"); -const https_1 = require("https"); -const url_1 = require("url"); -const ramda_1 = __importDefault(require("ramda")); -exports.configSchema = t.intersection([ - t.type({ - baseUrl: t.string, - }), - t.partial({ - storeView: t.string, - concurrency: t.number, - credentials: t.type({ - username: t.string, - password: t.string, - }), - insecure: t.boolean, - token: t.type({ - value: t.string, - expiration: t.string, - }), - }), -]); -const defaultConcurrency = 3; -class Magento2 { - constructor(config) { - this.config = config; - this.agent = this.config - .map(config => { - var _a; - return ({ - protocol: url_1.parse(config.baseUrl).protocol, - agentOptions: { - keepAlive: true, - maxSockets: (_a = config.concurrency) !== null && _a !== void 0 ? _a : defaultConcurrency, - }, - httpsOptions: { - rejectUnauthorized: !config.insecure, - }, - }); - }) - .map(({ protocol, agentOptions, httpsOptions }) => protocol === "https:" - ? new https_1.Agent({ ...agentOptions, ...httpsOptions }) - : new http_1.Agent(agentOptions)); - } - async get(uri, params) { - const paramsFlattened = params && flattenParams(params); - const paramsString = paramsFlattened ? `?${query_string_1.stringify(paramsFlattened)}` : ""; - return await this.fetch({ method: "GET", uri: uri + paramsString, auth: true }); - } - async *search(uri, { sortKey, filters = [] }) { - let additionalFilters = []; - while (1) { - const items = await this.fetchSearchResultsPage(uri, { - filters: [...filters, ...additionalFilters], - sortOrders: [[sortKey.query, "asc"]], - pageSize: 100, - currentPage: 1, - }); - if (items.length === 0) { - break; - } - yield* items; - const lastId = items.slice(-1)[0][sortKey.response]; - additionalFilters = [[sortKey.query, "gt", lastId]]; - } - } - async post(uri, content, fetchAsynchronously) { - return this.fetch({ method: "POST", uri, content, auth: true, fetchAsynchronously }); - } - async put(uri, content, fetchAsynchronously) { - return this.fetch({ method: "PUT", uri, content, auth: true, fetchAsynchronously }); - } - async patch(uri, content) { - return this.fetch({ method: "PATCH", uri, content, auth: true }); - } - async delete(uri, content) { - return this.fetch({ method: "DELETE", uri, content, auth: true }); - } - async fetchSearchResultsPage(uri, options) { - const { filters = [], pageSize, currentPage = 1, sortOrders = [] } = options; - const { items } = await this.get(uri, { - searchCriteria: { - filterGroups: filters.map(([field, conditionType, value]) => { - if (Array.isArray(value)) { - return { - filters: value.map((orValue) => ({ - field, - conditionType, - value: orValue, - })), - }; - } - return { filters: [{ field, conditionType, value }] }; - }), - sortOrders: sortOrders.map(([field, direction]) => ({ field, direction })), - pageSize, - currentPage, - }, - }); - return items; - } - async fetch(options) { - const async = options.fetchAsynchronously ? "/async" : ""; - const doFetch = (config) => { - const storeView = config.storeView ? `/${config.storeView}` : ""; - return node_fetch_1.default(`${config.baseUrl}/rest${storeView}${async}/V1/${options.uri}`, { - headers: { - Accept: "application/json", - ...(options.content ? { "Content-Type": "application/json" } : {}), - ...(options.auth ? { Authorization: `Bearer ${config.token.value}` } : {}), - }, - method: options.method, - body: options.content && JSON.stringify(options.content), - agent: this.agent.get(), - }); - }; - const currentConfig = this.config.get(); - const config = options.auth && !currentConfig.token ? await this.refreshToken() : currentConfig; - let response = await doFetch(config); - if (response.status === 401) { - const updatedConfig = await this.refreshToken(); - response = await doFetch(updatedConfig); - } - if (!response.ok) { - let detail = undefined; - try { - detail = await response.json(); - } - catch (_a) { - detail = undefined; - } - throw new framework_1.EndpointError(`${response.status} ${response.statusText}`, { detail }); - } - return await response.json(); - } - async refreshToken() { - const config = this.config.get(); - if (!config.credentials) { - throw new Error(`No Magento 2 credentials available for ${config.baseUrl}`); - } - const token = await this.getToken(config.credentials); - const updatedConfig = { ...config, token }; - this.config.set(updatedConfig); - return updatedConfig; - } - async getToken(credentials) { - const fourHoursFromNow = new Date(Date.now() + 4 * 3600000); - const tokenValue = await this.fetch({ - method: "POST", - uri: "integration/admin/token", - content: credentials, - auth: false, - }); - return { - value: tokenValue, - expiration: fourHoursFromNow.toISOString(), - }; - } -} -exports.default = Magento2; -const flattenParams = ramda_1.default.pipe((params) => ramda_1.default.toPairs(params), ramda_1.default.chain(([name, value]) => flattenParam(name, value)), pairs => ramda_1.default.fromPairs(pairs)); -function flattenParam(name, value) { - switch (typeof value) { - case "string": - return [[name, value]]; - case "number": - return [[name, value.toString()]]; - case "object": { - const entries = Array.isArray(value) - ? value.map((_value, index) => [index + 1, _value]) - : Object.entries(value); - return ramda_1.default.chain(([_name, _value]) => flattenParam(`${name}[${_name}]`, _value), entries); - } - case "undefined": - return []; - } -} diff --git a/lib/connectors/magento2/functions.d.ts b/lib/connectors/magento2/functions.d.ts deleted file mode 100644 index c05dbc2..0000000 --- a/lib/connectors/magento2/functions.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import Magento2, { Filter, SortKey } from "./client"; -import { DocId, EndpointDefinition, Path } from "../../framework"; -declare type CrudOptions = { - idField: string; - list: { - uri?: string; - sortKey: SortKey; - idField?: string; - }; -}; -export declare class endpoint { - private constructor(); - static crud(uriPattern: string, options: T): { - endpoints: { - create: EndpointDefinition; - createAsync: EndpointDefinition; - list: EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: Magento2) => (path: Path) => AsyncIterable; - endpoints: { - delete: EndpointDefinition; - get: EndpointDefinition; - update: EndpointDefinition; - }; - }; - }; - static fn(uriPattern: string, _fn: (client: Magento2, uri: string, data: I, path: ReadonlyArray) => Promise | AsyncIterable): EndpointDefinition; - static create: (uriPattern: string) => EndpointDefinition; - static createAsync: (uriPattern: string) => EndpointDefinition; - static del: (uriPattern: string) => EndpointDefinition; - static get: (uriPattern: string) => EndpointDefinition; - static list: (uriPattern: string, sortKey: SortKey) => EndpointDefinition; - static update: (uriPattern: string) => EndpointDefinition; - static updateAsync: (uriPattern: string) => EndpointDefinition; - static updateAsyncTEST: (uriPattern: string) => EndpointDefinition; -} -export {}; diff --git a/lib/connectors/magento2/functions.js b/lib/connectors/magento2/functions.js deleted file mode 100644 index 900ad48..0000000 --- a/lib/connectors/magento2/functions.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.endpoint = void 0; -const framework_1 = require("../../framework"); -const json_pipe_1 = require("@space48/json-pipe"); -class endpoint { - constructor() { - return; - } - static crud(uriPattern, options) { - var _a, _b, _c; - const docUriPattern = `${uriPattern}/{id}`; - return { - endpoints: { - create: endpoint.create(uriPattern), - createAsync: endpoint.createAsync(uriPattern), - list: endpoint.list((_a = options.list.uri) !== null && _a !== void 0 ? _a : uriPattern, options.list.sortKey), - }, - documents: { - idField: options.idField, - listIds: listIds((_b = options.list.uri) !== null && _b !== void 0 ? _b : uriPattern, (_c = options.list.idField) !== null && _c !== void 0 ? _c : options.idField, options.list.sortKey), - endpoints: { - delete: endpoint.del(docUriPattern), - get: endpoint.get(docUriPattern), - update: endpoint.update(docUriPattern), - }, - }, - }; - } - static fn(uriPattern, _fn) { - return client => ({ path, input }) => { - const uri = UriTemplate.uri(uriPattern, framework_1.Path.getDocIds(path)); - return _fn(client, uri, input, framework_1.Path.getDocIds(path)); - }; - } -} -exports.endpoint = endpoint; -endpoint.create = (uriPattern) => endpoint.fn(uriPattern, (m2Client, uri, data) => m2Client.post(uri, data)); -endpoint.createAsync = (uriPattern) => endpoint.fn(uriPattern, (m2Client, uri, data) => m2Client.post(uri, data, true)); -endpoint.del = (uriPattern) => endpoint.fn(uriPattern, (m2Client, uri, data) => m2Client.delete(uri, data)); -endpoint.get = (uriPattern) => endpoint.fn(uriPattern, (m2Client, uri) => m2Client.get(uri)); -endpoint.list = (uriPattern, sortKey) => endpoint.fn(uriPattern, (m2Client, uri, filters) => m2Client.search(uri, { sortKey, filters })); -endpoint.update = (uriPattern) => endpoint.fn(uriPattern, (m2Client, uri, data) => m2Client.put(uri, data)); -endpoint.updateAsync = (uriPattern) => endpoint.fn(uriPattern, (m2Client, uri, data) => m2Client.put(uri, data, true)); -endpoint.updateAsyncTEST = (uriPattern) => endpoint.fn(uriPattern, (m2Client, uri, data) => m2Client.put(uri, data, true)); -class UriTemplate { - static uri(uriTemplate, fieldValues) { - const uri = UriTemplate.applyValues(uriTemplate, fieldValues); - const missingValues = UriTemplate.fields(uri); - if (UriTemplate.fields(uri).length > 0) { - throw new Error(`Missing URI fields ${missingValues.join(", ")}`); - } - return uri; - } - static applyValues(uriTemplate, fieldValues) { - return UriTemplate.fields(uriTemplate) - .filter((field, index) => { var _a; return ((_a = fieldValues[index]) !== null && _a !== void 0 ? _a : null) !== null; }) - .reduce((uri, field, index) => uri.replace(`{${field}}`, String(fieldValues[index])), uriTemplate); - } - static fields(uriTemplate) { - var _a; - // todo: convert to matchAll once we support ES2020 - return (((_a = uriTemplate.match(/\{[^}]+\}/g)) === null || _a === void 0 ? void 0 : _a.map(match => match.substring(1, match.length - 1))) || []); - } -} -function listIds(uriPattern, idField, sortKey) { - return (client) => (path) => { - const uri = UriTemplate.uri(uriPattern, framework_1.Path.getDocIds(path)); - const docs = client.search(uri, { sortKey }); - return json_pipe_1.pipe(docs, json_pipe_1.map(doc => doc[idField])); - }; -} diff --git a/lib/connectors/magento2/index.d.ts b/lib/connectors/magento2/index.d.ts deleted file mode 100644 index 00f3760..0000000 --- a/lib/connectors/magento2/index.d.ts +++ /dev/null @@ -1,178 +0,0 @@ -import Magento2, { Config } from "./client"; -import * as f from "../../framework"; -export declare type Magento2Config = Config; -export declare const magento2: f.Connector<{ - baseUrl: string; -} & { - storeView?: string | undefined; - concurrency?: number | undefined; - credentials?: { - username: string; - password: string; - } | undefined; - insecure?: boolean | undefined; - token?: { - value: string; - expiration: string; - } | undefined; -}, Magento2, { - categories: f.ResourceDefinition; - createAsync: f.EndpointDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap & { - tree: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - }, { - idField: string; - listIds: (client: Magento2) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & f.DocumentDefinition>; - customers: { - endpoints: { - create: f.EndpointDefinition; - createAsync: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: Magento2) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - orders: { - endpoints: { - list: f.EndpointDefinition; - }; - documents: Pick<{ - idField: string; - listIds: (client: Magento2) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }, "endpoints" | "idField" | "listIds">; - }; - products: f.ResourceDefinition; - createAsync: f.EndpointDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap & { - attributes: f.ResourceDefinition; - createAsync: f.EndpointDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: Magento2) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - idField: string; - resources: { - options: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - }; - }>; - attributeGroups: { - endpoints: { - create: f.EndpointDefinition; - createAsync: f.EndpointDefinition; - list: f.EndpointDefinition; - }; - documents: { - idField: string; - listIds: (client: Magento2) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }; - }; - attributeSets: f.ResourceDefinition; - createAsync: f.EndpointDefinition; - list: f.EndpointDefinition; - } & f.EndpointDefinitionMap, f.ResourceDefinitionMap, { - idField: string; - listIds: (client: Magento2) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - attributes: { - documents: { - idField: string; - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - }; - }; - }; - groups: { - endpoints: { - put: f.EndpointDefinition; - }; - }; - }; - }>; - configurables: { - documents: { - idField: string; - resources: { - children: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - options: { - endpoints: { - get: f.EndpointDefinition; - }; - }; - }; - }; - }; - }, { - idField: string; - listIds: (client: Magento2) => (path: f.Path) => AsyncIterable; - endpoints: { - delete: f.EndpointDefinition; - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - } & { - resources: { - links: { - documents: { - idField: string; - endpoints: { - get: f.EndpointDefinition; - }; - }; - }; - }; - }>; -}>; diff --git a/lib/connectors/magento2/index.js b/lib/connectors/magento2/index.js deleted file mode 100644 index d8c70aa..0000000 --- a/lib/connectors/magento2/index.js +++ /dev/null @@ -1,163 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.magento2 = void 0; -const client_1 = __importStar(require("./client")); -const framework_1 = require("../../framework"); -const functions_1 = require("./functions"); -const url_1 = require("url"); -const ramda_1 = require("ramda"); -const mergeResources = framework_1.resourceMerger(); -exports.magento2 = framework_1.connector({ - configSchema: client_1.configSchema, - scopeNameExample: getScopeName("www.my-shop.com"), - getScopeName: config => getScopeName(config.baseUrl, config.storeView), - getScope: config => new client_1.default(config), - getWarningMessage: async (client) => Promise.resolve(), - resources: { - categories: mergeResources(functions_1.endpoint.crud("categories", { - idField: "id", - list: { - uri: "categories/list", - sortKey: { query: "entity_id", response: "id" }, - }, - }), { - resources: { - tree: { - endpoints: { - get: functions_1.endpoint.get("categories?rootCategoryId=1"), - }, - }, - }, - }), - customers: functions_1.endpoint.crud("customers", { - idField: "id", - list: { - uri: "customers/search", - sortKey: { query: "entity_id", response: "id" }, - }, - }), - orders: { - endpoints: { - list: functions_1.endpoint.list("orders", { query: "entity_id", response: "entity_id" }), - }, - documents: ramda_1.omit(["create"], functions_1.endpoint.crud("orders", { - idField: "id", - list: { - idField: "entity_id", - sortKey: { query: "entity_id", response: "entity_id" }, - }, - }).documents), - }, - products: mergeResources(functions_1.endpoint.crud("products", { - idField: "sku", - list: { - sortKey: { query: "entity_id", response: "id" }, - }, - }), { - documents: { - resources: { - links: { - documents: { - idField: "type", - endpoints: { - get: functions_1.endpoint.get("products/{sku}/links/{type}"), - }, - }, - }, - }, - }, - resources: { - attributes: mergeResources(functions_1.endpoint.crud("products/attributes", { - idField: "attribute_id", - list: { - sortKey: { query: "attribute_id", response: "attribute_id" }, - }, - }), { - documents: { - idField: "attribute_code", - resources: { - options: { - endpoints: { - get: functions_1.endpoint.get("products/attributes/{attributeCode}/options"), - }, - }, - }, - }, - }), - attributeGroups: functions_1.endpoint.crud("products/attribute-sets/groups", { - idField: "group_id", - list: { - uri: "products/attribute-sets/groups/list", - sortKey: { query: "attribute_set_id", response: "attribute_set_id" }, - }, - }), - attributeSets: mergeResources(functions_1.endpoint.crud("products/attribute-sets", { - idField: "attribute_set_id", - list: { - uri: "products/attribute-sets/sets/list", - sortKey: { query: "attribute_set_id", response: "attribute_set_id" }, - }, - }), { - documents: { - resources: { - attributes: { - documents: { - idField: "attribute_code", - endpoints: { - get: functions_1.endpoint.get("products/attribute-sets/{attributeSetId}/attributes/{attributeCode}"), - delete: functions_1.endpoint.del("products/attribute-sets/{attributeSetId}/attributes/{attributeCode}"), - }, - }, - }, - groups: { - endpoints: { - put: functions_1.endpoint.update("products/attribute-sets/{attributeSetId}/groups"), - }, - }, - }, - }, - }), - configurables: { - documents: { - idField: "sku", - resources: { - children: { - endpoints: { - get: functions_1.endpoint.get("configurable-products/{sku}/children"), - }, - }, - options: { - endpoints: { - get: functions_1.endpoint.get("configurable-products/{sku}/options/all"), - }, - }, - }, - }, - }, - }, - }), - }, -}); -function getScopeName(storeBaseUrl, storeView = "default") { - const { host, path } = url_1.parse(storeBaseUrl); - return `${host || ""}${path}`.replace(/\/$/, "").toLowerCase() + `/${storeView}`; -} diff --git a/lib/connectors/shopify/client.d.ts b/lib/connectors/shopify/client.d.ts deleted file mode 100644 index 9f6c84b..0000000 --- a/lib/connectors/shopify/client.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import * as t from "io-ts"; -import Shopify from "shopify-api-node"; -import { MutableReference } from "../../framework"; -export declare type Config = t.TypeOf; -export declare const configSchema: t.TypeC<{ - shopName: t.StringC; - credentials: t.TypeC<{ - apiKey: t.StringC; - password: t.StringC; - }>; -}>; -export declare class Scope { - private readonly config; - constructor(config: MutableReference); - private clientConfig?; - private _client?; - client(): Shopify; - map(resourceKey: string, endpointKey: string, ids: any[], input?: any): Promise; - flatMap(resourceKey: string, endpointKey: string, ids: any[], input?: any): AsyncIterable; - listIds(resourceKey: string, endpointKey: string, ids: any[], input?: any): AsyncIterable; -} diff --git a/lib/connectors/shopify/client.js b/lib/connectors/shopify/client.js deleted file mode 100644 index 9adf787..0000000 --- a/lib/connectors/shopify/client.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Scope = exports.configSchema = void 0; -const t = __importStar(require("io-ts")); -const p_retry_1 = __importDefault(require("p-retry")); -const shopify_api_node_1 = __importDefault(require("shopify-api-node")); -const framework_1 = require("../../framework"); -exports.configSchema = t.type({ - shopName: t.string, - credentials: t.type({ - apiKey: t.string, - password: t.string, - }), -}); -class Scope { - constructor(config) { - this.config = config; - this.clientConfig = undefined; - this._client = undefined; - } - client() { - var _a, _b, _c; - const currentConfig = this.config.get(); - if (!(currentConfig.shopName === ((_a = this.clientConfig) === null || _a === void 0 ? void 0 : _a.shopName) && - currentConfig.credentials.apiKey === ((_b = this.clientConfig) === null || _b === void 0 ? void 0 : _b.credentials.apiKey) && - currentConfig.credentials.password === ((_c = this.clientConfig) === null || _c === void 0 ? void 0 : _c.credentials.password))) { - const client = new shopify_api_node_1.default({ - shopName: currentConfig.shopName, - ...currentConfig.credentials, - apiVersion: "2020-10", - }); - const requestFn = client.request.bind(client); - client.request = backoff(requestFn); - this._client = client; - } - return this._client; - } - async map(resourceKey, endpointKey, ids, input) { - const client = this.client(); - return client[resourceKey][endpointKey](...ids, input); - } - async *flatMap(resourceKey, endpointKey, ids, input) { - let _params = { ...input, limit: 250 }; - do { - const result = await this.map(resourceKey, endpointKey, ids, _params); - yield* result; - _params = result.nextPageParameters; - } while (_params); - } - async *listIds(resourceKey, endpointKey, ids, input) { - for await (const item of this.flatMap(resourceKey, endpointKey, ids, input)) { - yield item.id; - } - } -} -exports.Scope = Scope; -const backoff = (fn) => (...args) => { - const run = async () => { - var _a, _b, _c; - try { - return await fn(...args); - } - catch (e) { - const actionError = new framework_1.EndpointError(e.message, { - detail: typeof ((_a = e.response) === null || _a === void 0 ? void 0 : _a.body) === "object" ? (_b = e.response.body.errors) !== null && _b !== void 0 ? _b : e.response.body : null, - }); - throw ((_c = e.response) === null || _c === void 0 ? void 0 : _c.statusCode) == 429 ? actionError : new p_retry_1.default.AbortError(actionError); - } - }; - return p_retry_1.default(run, { retries: 50 }); -}; diff --git a/lib/connectors/shopify/codegen/configuration.d.ts b/lib/connectors/shopify/codegen/configuration.d.ts deleted file mode 100644 index d1d17ba..0000000 --- a/lib/connectors/shopify/codegen/configuration.d.ts +++ /dev/null @@ -1,740 +0,0 @@ -/** - * Here we configure endpoints which we have automatically inferred - * from the API of shopify-api-node. Most endpoints are standard, - * e.g. get, list, create, delete, etc., and do not need to be - * configured. We only configure endpoints which are non-standard. - * - * `false` disables a resource or endpoint. In all cases, the disabled - * endpoints can be enabled if they are needed -- just configure the - * endpoint you need in the same way that other endpoints are - * configured below. - */ -export declare const resourceDefinitions: { - location: import("../../..").ResourceDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - inventoryLevels: import("../../..").EndpointDefinition; - }; - }>; - comment: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - spam: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - notSpam: import("../../..").EndpointDefinition; - approve: import("../../..").EndpointDefinition; - remove: import("../../..").EndpointDefinition; - restore: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - spam: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - notSpam: import("../../..").EndpointDefinition; - approve: import("../../..").EndpointDefinition; - remove: import("../../..").EndpointDefinition; - restore: import("../../..").EndpointDefinition; - }; - }>; - product: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - resources: { - productImage: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - productVariant: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - productResourceFeedback: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - customer: import("../../..").ResourceDefinition | import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - accountActivationUrl: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }, Record, { - resources: { - customerAddress: import("../../..").ResourceDefinition | import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - default: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - search: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - orders: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - accountActivationUrl: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }; - }>; - dispute: import("../../..").ResourceDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - }; - }>; - payout: import("../../..").ResourceDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - }; - }>; - collection: import("../../..").ResourceDefinition, { - endpoints: { - get: import("../../..").EndpointDefinition; - products: import("../../..").EndpointDefinition; - }; - }>; - page: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - shop: import("../../..").ResourceDefinition, { - endpoints: { - get: import("../../..").EndpointDefinition; - }; - }>; - checkout: import("../../..").ResourceDefinition; - complete: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - shippingRates: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }, Record, { - resources: { - payment: import("../../..").ResourceDefinition | import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - complete: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - shippingRates: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }; - }>; - order: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - resources: { - refund: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - calculate: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - }; - }>; - fulfillment: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - updateTracking: import("../../..").EndpointDefinition; - }, Record, { - resources: { - fulfillmentEvent: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - open: import("../../..").EndpointDefinition; - complete: import("../../..").EndpointDefinition; - cancel: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - createV2: import("../../..").EndpointDefinition; - updateTracking: import("../../..").EndpointDefinition; - }; - }>; - orderRisk: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - transaction: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - close: import("../../..").EndpointDefinition; - open: import("../../..").EndpointDefinition; - cancel: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - fulfillmentOrders: import("../../..").EndpointDefinition; - }; - }>; - accessScope: import("../../..").ResourceDefinition; - }, Record, {}>; - apiPermission: import("../../..").ResourceDefinition, { - endpoints: { - delete: import("../../..").EndpointDefinition; - }; - }>; - applicationCharge: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - activate: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - activate: import("../../..").EndpointDefinition; - }; - }>; - applicationCredit: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - }; - }>; - balance: import("../../..").ResourceDefinition; - transactions: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - transactions: import("../../..").EndpointDefinition; - }; - }>; - blog: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - resources: { - article: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - authors: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - authors: import("../../..").EndpointDefinition; - tags: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - carrierService: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - collect: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - }; - }>; - collectionListing: import("../../..").ResourceDefinition; - productIds: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - productIds: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }; - }>; - country: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - resources: { - province: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - currency: import("../../..").ResourceDefinition; - }, Record, {}>; - customCollection: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - customerSavedSearch: import("../../..").ResourceDefinition; - customers: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - customers: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - draftOrder: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - complete: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - sendInvoice: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }; - }>; - fulfillmentEvent: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - fulfillmentOrder: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - move: import("../../..").EndpointDefinition; - cancel: import("../../..").EndpointDefinition; - locationsForMove: import("../../..").EndpointDefinition; - }, Record, { - resources: { - cancellationRequest: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - accept: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - reject: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - accept: import("../../..").EndpointDefinition; - }; - }>; - fulfillmentRequest: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - accept: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - reject: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - accept: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - close: import("../../..").EndpointDefinition; - move: import("../../..").EndpointDefinition; - cancel: import("../../..").EndpointDefinition; - locationsForMove: import("../../..").EndpointDefinition; - }; - }>; - fulfillmentService: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - giftCard: import("../../..").ResourceDefinition | import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - resources: { - giftCardAdjustment: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - search: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - disable: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }; - }>; - inventoryItem: import("../../..").ResourceDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - inventoryLevel: import("../../..").ResourceDefinition; - connect: import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - adjust: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - connect: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - adjust: import("../../..").EndpointDefinition; - }; - }>; - marketingEvent: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - engagements: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - engagements: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }; - }>; - metafield: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - policy: import("../../..").ResourceDefinition; - }, Record, {}>; - priceRule: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - resources: { - discountCodeCreationJob: import("../../..").ResourceDefinition; - discountCodes: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - discountCodes: import("../../..").EndpointDefinition; - }; - }>; - discountCode: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - productListing: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - productIds: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - productIds: import("../../..").EndpointDefinition | import("../../..").EndpointDefinition; - }; - }>; - resourceFeedback: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, {}>; - recurringApplicationCharge: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - activate: import("../../..").EndpointDefinition; - customize: import("../../..").EndpointDefinition; - }, Record, { - resources: { - usageCharge: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - activate: import("../../..").EndpointDefinition; - customize: import("../../..").EndpointDefinition; - }; - }>; - redirect: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - report: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - scriptTag: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - shippingZone: import("../../..").ResourceDefinition; - }, Record, {}>; - smartCollection: import("../../..").ResourceDefinition; - products: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - order: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - products: import("../../..").EndpointDefinition; - order: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - storefrontAccessToken: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - delete: import("../../..").EndpointDefinition; - }; - }>; - tenderTransaction: import("../../..").ResourceDefinition; - }, Record, {}>; - theme: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - }, Record, { - resources: { - asset: import("../../..").ResourceDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - list: import("../../..").EndpointDefinition; - create: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - }; - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; - user: import("../../..").ResourceDefinition; - current: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - }; - }>; - webhook: import("../../..").ResourceDefinition; - create: import("../../..").EndpointDefinition; - count: import("../../..").EndpointDefinition; - }, Record, { - endpoints: { - get: import("../../..").EndpointDefinition; - delete: import("../../..").EndpointDefinition; - update: import("../../..").EndpointDefinition; - }; - }>; -}; diff --git a/lib/connectors/shopify/codegen/configuration.js b/lib/connectors/shopify/codegen/configuration.js deleted file mode 100644 index ad0673a..0000000 --- a/lib/connectors/shopify/codegen/configuration.js +++ /dev/null @@ -1,211 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resourceDefinitions = void 0; -const connector_generator_1 = require("./connector-generator"); -/** - * Here we configure endpoints which we have automatically inferred - * from the API of shopify-api-node. Most endpoints are standard, - * e.g. get, list, create, delete, etc., and do not need to be - * configured. We only configure endpoints which are non-standard. - * - * `false` disables a resource or endpoint. In all cases, the disabled - * endpoints can be enabled if they are needed -- just configure the - * endpoint you need in the same way that other endpoints are - * configured below. - */ -exports.resourceDefinitions = connector_generator_1.computeResourceDefinitions({ - applicationCharge: false, - blog: { - resources: { - article: { - endpoints: { - authors: false, - tags: { - target: "document", - type: "map", - }, - }, - }, - }, - }, - balance: false, - checkout: false, - collection: { - endpoints: { - products: { - target: "document", - type: "flatMap", - }, - }, - }, - collectionListing: { - endpoints: { - productIds: false, - }, - }, - comment: false, - customer: { - endpoints: { - accountActivationUrl: false, - orders: { - target: "document", - type: "map", - }, - search: false, - sendInvite: { - target: "document", - type: "map", - }, - }, - resources: { - customerAddress: { - endpoints: { - default: { - target: "document", - type: "map", - }, - set: { - target: "resource", - type: "map", - }, - }, - }, - }, - }, - customerSavedSearch: false, - draftOrder: { - endpoints: { - complete: { - target: "document", - type: "map", - }, - sendInvoice: { - target: "document", - type: "map", - }, - }, - }, - fulfillmentOrder: false, - giftCard: { - endpoints: { - disable: { - target: "document", - type: "map", - }, - search: false, - }, - }, - inventoryLevel: { - endpoints: { - adjust: false, - connect: false, - set: { - target: "resource", - type: "map", - }, - }, - }, - location: { - endpoints: { - inventoryLevels: { - target: "document", - type: "flatMap", - }, - }, - }, - marketingEvent: false, - order: { - endpoints: { - cancel: { - target: "document", - type: "map", - }, - close: { - target: "document", - type: "map", - }, - fulfillmentOrders: { - target: "document", - type: "map", - }, - list: { - params: { status: "any" }, - }, - open: { - target: "document", - type: "map", - }, - }, - resources: { - fulfillment: { - endpoints: { - cancel: { - target: "document", - type: "map", - }, - createV2: { - target: "document", - type: "map", - }, - complete: { - target: "document", - type: "map", - }, - open: { - target: "document", - type: "map", - }, - updateTracking: false, - }, - }, - refund: { - endpoints: { - calculate: { - target: "resource", - type: "map", - }, - }, - }, - }, - }, - priceRule: { - resources: { - discountCode: { - endpoints: { - lookup: { - target: "resource", - type: "map", - }, - }, - }, - discountCodeCreationJob: false, - }, - }, - productListing: { - endpoints: { - productIds: false, - }, - }, - recurringApplicationCharge: false, - shop: { - endpoints: { - get: { - target: "resource", - }, - }, - }, - smartCollection: { - endpoints: { - order: false, - products: false, - }, - }, - user: { - endpoints: { - current: { - target: "resource", - type: "map", - }, - }, - }, -}); diff --git a/lib/connectors/shopify/codegen/connector-generator.d.ts b/lib/connectors/shopify/codegen/connector-generator.d.ts deleted file mode 100644 index a2835e4..0000000 --- a/lib/connectors/shopify/codegen/connector-generator.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { InferredResource, InferredResources } from "../resource-inference"; -import * as client from "../client"; -import t from "ts-toolbelt"; -import { EndpointDefinition, ResourceDefinition } from "../../../framework"; -import Shopify from "shopify-api-node"; -/** Definition inference */ -export declare function computeResourceDefinitions(config: C): InferResourceDefnMap; -declare type InferResourceDefnMap, Config, Depth extends string> = RemoveEmptyProps<{ - [K in keyof T]: InferResourceDefn, Depth>; -}>; -declare type InferResourceDefn = ResourceDefinition, "resource", Depth>, Record, InferDocumentDefn>>; -declare type InferDocumentDefn = RemoveEmptyProps<{ - endpoints: InferEndpointDefnMap, "document", Depth>; - resources: InferResourceDefnMap>, Depth>; -}>; -declare type InferEndpointDefnMap = RemoveEmptyProps<{ - [K in Res["endpoints"][number]]: InferEndpointDefn, Target, t.N.Format>; -}>; -declare type InferEndpointDefn = ResolveEndpointTarget extends Target ? EndpointK extends keyof Shopify[ResourceK] ? Shopify[ResourceK][EndpointK] extends (...args: infer Args) => Promise ? Ret extends (infer RetInner)[] ? EndpointDefinition : EndpointDefinition : never : never : never; -declare type ResolveEndpointTarget = Config extends false ? never : Config extends FullEndpointConfig ? Target : StandardEndpointConfig["target"]; -/** Configuration types */ -export declare type ShopifyConnectorConfig = MakeValuesOptionalWhereAppropriate>; -declare type ResourcesConfig> = MakeValuesOptionalWhereAppropriate<{ - [K in keyof T]: ResourceConfig; -}>; -declare type ResourceConfig = MakeValuesOptionalWhereAppropriate<{ - endpoints: EndpointsConfig; - resources: ResourcesConfig; -}> | false; -declare type EndpointsConfig = MakeValuesOptionalWhereAppropriate<{ - [K in Key]: EndpointConfig; -}>; -declare type EndpointConfig = DecorateEndpointConfig; -declare type FullEndpointConfig = { - target: Target; - type: Type; - params?: object; -}; -declare type EndpointTarget = "document" | "resource"; -declare type EndpointType = "map" | "flatMap"; -declare type DecorateEndpointConfig = (Optionality extends "optional" ? Partial | undefined : T) | false; -declare type StandardEndpointKey = keyof typeof standardEndpoints; -declare type StandardEndpointConfig = Key extends StandardEndpointKey ? typeof standardEndpoints[Key] : never; -declare const standardEndpoints: { - readonly count: { - readonly target: "resource"; - readonly type: "map"; - }; - readonly create: { - readonly target: "resource"; - readonly type: "map"; - }; - readonly delete: { - readonly target: "document"; - readonly type: "map"; - }; - readonly get: { - readonly target: "document"; - readonly type: "map"; - }; - readonly update: { - readonly target: "document"; - readonly type: "map"; - }; - readonly list: { - readonly target: "resource"; - readonly type: "flatMap"; - }; -}; -/** Utility types */ -declare type MakeValuesOptionalWhereAppropriate = PermitUndefinedIfPermitsEmptyObject>; -declare type MakePropsPermittingUndefinedOptional = MakePropsOptional>; -declare type PermitUndefinedIfPermitsEmptyObject = Record extends T ? T | undefined : T; -declare type MakePropsOptional = t.Object.Merge<{ - [K in OptionalProps]?: T[K]; -}, { - [K in Exclude]: T[K]; -}>; -declare type PropsPermittingUndefined = { - [K in keyof T]: undefined extends T[K] ? K : never; -}[keyof T]; -declare type Prop = K extends keyof T ? T[K] : Default; -declare type RemoveEmptyProps = FilterProps>; -declare type FilterProps = { - [K in FilterKeys]: O[K] extends never ? never : O[K]; -}; -declare type FilterKeys = { - [K in keyof O]: O[K] extends Match ? never : K; -}[keyof O]; -export {}; diff --git a/lib/connectors/shopify/codegen/connector-generator.js b/lib/connectors/shopify/codegen/connector-generator.js deleted file mode 100644 index 3265ee9..0000000 --- a/lib/connectors/shopify/codegen/connector-generator.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.computeResourceDefinitions = void 0; -const resource_inference_1 = require("../resource-inference"); -const framework_1 = require("../../../framework"); -const ramda_1 = __importDefault(require("ramda")); -/** Definition inference */ -function computeResourceDefinitions(config) { - return resourceDefinitions(resource_inference_1.inferredResources, config); -} -exports.computeResourceDefinitions = computeResourceDefinitions; -function resourceDefinitions(inferred, config) { - return ramda_1.default.filter(Boolean, ramda_1.default.mapObjIndexed(inferredResource => resourceDefinition(inferredResource, config === null || config === void 0 ? void 0 : config[inferredResource.key]), inferred)); -} -function resourceDefinition(inferred, config) { - if (config === false) { - return {}; - } - const endpoints = endpointDefinitions(inferred.key, inferred.endpoints, config === null || config === void 0 ? void 0 : config["endpoints"], "resource"); - return { - endpoints, - documents: { - ...documentDefinition(inferred, config), - listIds: endpoints.list && - (scope => path => { - var _a, _b; - return scope.listIds(inferred.key, "list", framework_1.Path.getDocIds(path), (_b = (_a = config === null || config === void 0 ? void 0 : config["endpoints"]) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b.params); - }), - }, - }; -} -function documentDefinition(inferred, config) { - if (config === false) { - return {}; - } - return { - endpoints: endpointDefinitions(inferred.key, inferred.endpoints, config === null || config === void 0 ? void 0 : config["endpoints"], "document"), - resources: resourceDefinitions(inferred.children, config === null || config === void 0 ? void 0 : config["resources"]), - }; -} -function endpointDefinitions(resourceKey, keys, config, target) { - try { - return ramda_1.default.filter(Boolean, ramda_1.default.fromPairs(keys.map(endpointKey => [ - endpointKey, - endpointDefinition(resourceKey, endpointKey, config === null || config === void 0 ? void 0 : config[endpointKey], target), - ]))); - } - catch (e) { - console.error({ resourceKey, keys, config, target }); - throw e; - } -} -function endpointDefinition(resourceKey, endpointKey, config, target) { - if (config === false) { - return undefined; - } - const resolvedConfig = { - ...standardEndpoints[endpointKey], - ...config, - }; - if (!resolvedConfig.type) { - throw new Error(`Shopify: Could not resolve config for ${resourceKey}.${endpointKey}().`); - } - if (resolvedConfig.target !== target) { - return undefined; - } - if (resolvedConfig.type === "flatMap") { - return scope => ({ path, input }) => scope.flatMap(resourceKey, endpointKey, framework_1.Path.getDocIds(path), { - ...resolvedConfig.params, - ...input, - }); - } - return scope => ({ path, input }) => scope.map(resourceKey, endpointKey, framework_1.Path.getDocIds(path), { - ...resolvedConfig.params, - ...input, - }); -} -const standardEndpoints = { - count: { - target: "resource", - type: "map", - }, - create: { - target: "resource", - type: "map", - }, - delete: { - target: "document", - type: "map", - }, - get: { - target: "document", - type: "map", - }, - update: { - target: "document", - type: "map", - }, - list: { - target: "resource", - type: "flatMap", - }, -}; diff --git a/lib/connectors/shopify/codegen/index.d.ts b/lib/connectors/shopify/codegen/index.d.ts deleted file mode 100644 index 7a72c8b..0000000 --- a/lib/connectors/shopify/codegen/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { resourceDefinitions } from "./configuration"; diff --git a/lib/connectors/shopify/codegen/index.js b/lib/connectors/shopify/codegen/index.js deleted file mode 100644 index c2aee12..0000000 --- a/lib/connectors/shopify/codegen/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resourceDefinitions = void 0; -var configuration_1 = require("./configuration"); -Object.defineProperty(exports, "resourceDefinitions", { enumerable: true, get: function () { return configuration_1.resourceDefinitions; } }); diff --git a/lib/connectors/shopify/index.d.ts b/lib/connectors/shopify/index.d.ts deleted file mode 100644 index e085f70..0000000 --- a/lib/connectors/shopify/index.d.ts +++ /dev/null @@ -1,738 +0,0 @@ -import * as client from "./client"; -import * as f from "../../framework"; -import Shopify from "shopify-api-node"; -export declare const shopify: f.Connector<{ - shopName: string; - credentials: { - apiKey: string; - password: string; - }; -}, client.Scope, { - location: f.ResourceDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - inventoryLevels: f.EndpointDefinition; - }; - }>; - comment: f.ResourceDefinition; - create: f.EndpointDefinition; - spam: f.EndpointDefinition; - count: f.EndpointDefinition; - notSpam: f.EndpointDefinition; - approve: f.EndpointDefinition; - remove: f.EndpointDefinition; - restore: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - spam: f.EndpointDefinition; - update: f.EndpointDefinition; - notSpam: f.EndpointDefinition; - approve: f.EndpointDefinition; - remove: f.EndpointDefinition; - restore: f.EndpointDefinition; - }; - }>; - product: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - resources: { - productImage: f.ResourceDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - count: f.EndpointDefinition; - update: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - count: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - productVariant: f.ResourceDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - count: f.EndpointDefinition; - update: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - count: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - productResourceFeedback: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - customer: f.ResourceDefinition | f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - accountActivationUrl: f.EndpointDefinition | f.EndpointDefinition; - }, Record, { - resources: { - customerAddress: f.ResourceDefinition | f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - default: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - search: f.EndpointDefinition | f.EndpointDefinition; - orders: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - accountActivationUrl: f.EndpointDefinition | f.EndpointDefinition; - }; - }>; - dispute: f.ResourceDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - }; - }>; - payout: f.ResourceDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - }; - }>; - collection: f.ResourceDefinition, { - endpoints: { - get: f.EndpointDefinition; - products: f.EndpointDefinition; - }; - }>; - page: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - shop: f.ResourceDefinition, { - endpoints: { - get: f.EndpointDefinition; - }; - }>; - checkout: f.ResourceDefinition; - complete: f.EndpointDefinition | f.EndpointDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - shippingRates: f.EndpointDefinition | f.EndpointDefinition; - }, Record, { - resources: { - payment: f.ResourceDefinition | f.EndpointDefinition; - list: f.EndpointDefinition | f.EndpointDefinition; - create: f.EndpointDefinition | f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition | f.EndpointDefinition; - list: f.EndpointDefinition | f.EndpointDefinition; - create: f.EndpointDefinition | f.EndpointDefinition; - count: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - complete: f.EndpointDefinition | f.EndpointDefinition; - update: f.EndpointDefinition; - shippingRates: f.EndpointDefinition | f.EndpointDefinition; - }; - }>; - order: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - resources: { - refund: f.ResourceDefinition; - create: f.EndpointDefinition; - calculate: f.EndpointDefinition | f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - }; - }>; - fulfillment: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - updateTracking: f.EndpointDefinition; - }, Record, { - resources: { - fulfillmentEvent: f.ResourceDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - open: f.EndpointDefinition; - complete: f.EndpointDefinition; - cancel: f.EndpointDefinition; - update: f.EndpointDefinition; - createV2: f.EndpointDefinition; - updateTracking: f.EndpointDefinition; - }; - }>; - orderRisk: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - transaction: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - close: f.EndpointDefinition; - open: f.EndpointDefinition; - cancel: f.EndpointDefinition; - delete: f.EndpointDefinition | f.EndpointDefinition; - update: f.EndpointDefinition; - fulfillmentOrders: f.EndpointDefinition; - }; - }>; - accessScope: f.ResourceDefinition; - }, Record, {}>; - apiPermission: f.ResourceDefinition, { - endpoints: { - delete: f.EndpointDefinition; - }; - }>; - applicationCharge: f.ResourceDefinition; - create: f.EndpointDefinition; - activate: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - activate: f.EndpointDefinition; - }; - }>; - applicationCredit: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - }; - }>; - balance: f.ResourceDefinition; - transactions: f.EndpointDefinition; - }, Record, { - endpoints: { - transactions: f.EndpointDefinition; - }; - }>; - blog: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - resources: { - article: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - authors: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - authors: f.EndpointDefinition; - tags: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - carrierService: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - collect: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - }; - }>; - collectionListing: f.ResourceDefinition; - productIds: f.EndpointDefinition | f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - productIds: f.EndpointDefinition | f.EndpointDefinition; - }; - }>; - country: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - resources: { - province: f.ResourceDefinition; - list: f.EndpointDefinition; - count: f.EndpointDefinition; - update: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - list: f.EndpointDefinition; - count: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - currency: f.ResourceDefinition; - }, Record, {}>; - customCollection: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - customerSavedSearch: f.ResourceDefinition; - customers: f.EndpointDefinition | f.EndpointDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - customers: f.EndpointDefinition | f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - draftOrder: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - complete: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - sendInvoice: f.EndpointDefinition | f.EndpointDefinition; - }; - }>; - fulfillmentEvent: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - fulfillmentOrder: f.ResourceDefinition; - list: f.EndpointDefinition; - move: f.EndpointDefinition; - cancel: f.EndpointDefinition; - locationsForMove: f.EndpointDefinition; - }, Record, { - resources: { - cancellationRequest: f.ResourceDefinition; - create: f.EndpointDefinition; - accept: f.EndpointDefinition; - }, Record, { - endpoints: { - reject: f.EndpointDefinition; - create: f.EndpointDefinition; - accept: f.EndpointDefinition; - }; - }>; - fulfillmentRequest: f.ResourceDefinition; - create: f.EndpointDefinition; - accept: f.EndpointDefinition; - }, Record, { - endpoints: { - reject: f.EndpointDefinition; - create: f.EndpointDefinition; - accept: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - close: f.EndpointDefinition; - move: f.EndpointDefinition; - cancel: f.EndpointDefinition; - locationsForMove: f.EndpointDefinition; - }; - }>; - fulfillmentService: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - giftCard: f.ResourceDefinition | f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - resources: { - giftCardAdjustment: f.ResourceDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - search: f.EndpointDefinition | f.EndpointDefinition; - update: f.EndpointDefinition; - disable: f.EndpointDefinition | f.EndpointDefinition; - }; - }>; - inventoryItem: f.ResourceDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - inventoryLevel: f.ResourceDefinition; - connect: f.EndpointDefinition; - list: f.EndpointDefinition; - adjust: f.EndpointDefinition; - }, Record, { - endpoints: { - connect: f.EndpointDefinition; - delete: f.EndpointDefinition; - adjust: f.EndpointDefinition; - }; - }>; - marketingEvent: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - engagements: f.EndpointDefinition | f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - engagements: f.EndpointDefinition | f.EndpointDefinition; - }; - }>; - metafield: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - policy: f.ResourceDefinition; - }, Record, {}>; - priceRule: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - resources: { - discountCodeCreationJob: f.ResourceDefinition; - discountCodes: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - discountCodes: f.EndpointDefinition; - }; - }>; - discountCode: f.ResourceDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - productListing: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - productIds: f.EndpointDefinition | f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - productIds: f.EndpointDefinition | f.EndpointDefinition; - }; - }>; - resourceFeedback: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, {}>; - recurringApplicationCharge: f.ResourceDefinition; - create: f.EndpointDefinition; - activate: f.EndpointDefinition; - customize: f.EndpointDefinition; - }, Record, { - resources: { - usageCharge: f.ResourceDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - activate: f.EndpointDefinition; - customize: f.EndpointDefinition; - }; - }>; - redirect: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - report: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - scriptTag: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - shippingZone: f.ResourceDefinition; - }, Record, {}>; - smartCollection: f.ResourceDefinition; - products: f.EndpointDefinition; - create: f.EndpointDefinition; - order: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - products: f.EndpointDefinition; - order: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - storefrontAccessToken: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - endpoints: { - delete: f.EndpointDefinition; - }; - }>; - tenderTransaction: f.ResourceDefinition; - }, Record, {}>; - theme: f.ResourceDefinition; - create: f.EndpointDefinition; - }, Record, { - resources: { - asset: f.ResourceDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - list: f.EndpointDefinition; - create: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - }; - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; - user: f.ResourceDefinition; - current: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - }; - }>; - webhook: f.ResourceDefinition; - create: f.EndpointDefinition; - count: f.EndpointDefinition; - }, Record, { - endpoints: { - get: f.EndpointDefinition; - delete: f.EndpointDefinition; - update: f.EndpointDefinition; - }; - }>; -}>; diff --git a/lib/connectors/shopify/index.js b/lib/connectors/shopify/index.js deleted file mode 100644 index a779548..0000000 --- a/lib/connectors/shopify/index.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.shopify = void 0; -const framework_1 = require("../../framework"); -const client = __importStar(require("./client")); -const codegen_1 = require("./codegen"); -exports.shopify = framework_1.connector({ - configSchema: client.configSchema, - getScope: config => new client.Scope(config), - scopeNameExample: "my-shop-name", - getScopeName: config => config.shopName, - getWarningMessage: async (scope) => { - try { - const shop = await scope.client().shop.get(); - if (!shop.password_enabled) { - return `Shop is LIVE at ${shop.domain}`; - } - if (shop.domain !== shop.myshopify_domain) { - return `Shop is using custom domain ${shop.domain}`; - } - } - catch (_a) { - return "Failed to fetch shop data from Shopify API. This could be a live shop."; - } - }, - resources: codegen_1.resourceDefinitions, -}); diff --git a/lib/connectors/shopify/resource-inference/generate-shopify-resources.d.ts b/lib/connectors/shopify/resource-inference/generate-shopify-resources.d.ts deleted file mode 100644 index b798801..0000000 --- a/lib/connectors/shopify/resource-inference/generate-shopify-resources.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -export {}; diff --git a/lib/connectors/shopify/resource-inference/generate-shopify-resources.js b/lib/connectors/shopify/resource-inference/generate-shopify-resources.js deleted file mode 100644 index cd23b70..0000000 --- a/lib/connectors/shopify/resource-inference/generate-shopify-resources.js +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const inference_1 = require("./inference"); -inference_1.refreshInferredResources(); diff --git a/lib/connectors/shopify/resource-inference/index.d.ts b/lib/connectors/shopify/resource-inference/index.d.ts deleted file mode 100644 index 785bba0..0000000 --- a/lib/connectors/shopify/resource-inference/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import inferredResources from "./inferred-resources"; -export { InferredResource } from "./inference"; -export declare type InferredResources = typeof inferredResources; -export { inferredResources }; diff --git a/lib/connectors/shopify/resource-inference/index.js b/lib/connectors/shopify/resource-inference/index.js deleted file mode 100644 index 89c56cc..0000000 --- a/lib/connectors/shopify/resource-inference/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.inferredResources = void 0; -const inferred_resources_1 = __importDefault(require("./inferred-resources")); -exports.inferredResources = inferred_resources_1.default; diff --git a/lib/connectors/shopify/resource-inference/inference.d.ts b/lib/connectors/shopify/resource-inference/inference.d.ts deleted file mode 100644 index 0595e3e..0000000 --- a/lib/connectors/shopify/resource-inference/inference.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Shopify from "shopify-api-node"; -export declare type InferredResource = { - key: keyof Shopify; - endpoints: readonly string[]; - children: Record; -}; -export declare function refreshInferredResources(): void; diff --git a/lib/connectors/shopify/resource-inference/inference.js b/lib/connectors/shopify/resource-inference/inference.js deleted file mode 100644 index c21a8bb..0000000 --- a/lib/connectors/shopify/resource-inference/inference.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.refreshInferredResources = void 0; -const fs_1 = require("fs"); -const path_1 = require("path"); -const ramda_1 = __importDefault(require("ramda")); -function refreshInferredResources() { - const resources = inferResourcesFromShopifyModule(); - const output = `${__dirname}/inferred-resources.ts`; - fs_1.writeFileSync(output, `export default ${JSON.stringify(resources, null, 2)} as const;`); -} -exports.refreshInferredResources = refreshInferredResources; -function inferResourcesFromShopifyModule() { - const pathToShopifyIndexDotJs = require.resolve("shopify-api-node"); - const pathToResources = `${path_1.dirname(pathToShopifyIndexDotJs)}/resources`; - const inferredResourcesFlat = fs_1.readdirSync(pathToResources) - .filter(filename => filename.endsWith(".js") && filename !== "index.js") - .map((filename) => { - var _a; - //eslint-disable-next-line @typescript-eslint/no-var-requires - const resourceConstructor = require(`${pathToResources}/${filename}`); - const resource = new resourceConstructor(null); - return { - key: hyphenatedToCamelCase(path_1.basename(filename, ".js")), - name: resource.name, - parentName: (_a = resource.parentName) !== null && _a !== void 0 ? _a : null, - endpoints: Object.keys(resourceConstructor.prototype).filter(prop => prop !== "buildUrl"), - }; - }); - return buildTree(inferredResourcesFlat); -} -function buildTree(flatData) { - const resourcesByName = ramda_1.default.fromPairs(flatData.map((resource) => [ - resource.name, - { - key: resource.key, - endpoints: resource.endpoints, - children: {}, - }, - ])); - flatData - .filter(resource => resource.parentName) - .forEach(resource => { - resourcesByName[resource.parentName].children[resource.key] = resourcesByName[resource.name]; - }); - const rootResources = flatData - .filter(resource => !resource.parentName) - .map(resource => resourcesByName[resource.name]); - return ramda_1.default.fromPairs(rootResources.map(resource => [resource.key, resource])); -} -function hyphenatedToCamelCase(value) { - return value.replace(/-[a-z]/g, g => `${g[1].toUpperCase()}`); -} diff --git a/lib/connectors/shopify/resource-inference/inferred-resources.d.ts b/lib/connectors/shopify/resource-inference/inferred-resources.d.ts deleted file mode 100644 index f3e3e70..0000000 --- a/lib/connectors/shopify/resource-inference/inferred-resources.d.ts +++ /dev/null @@ -1,350 +0,0 @@ -declare const _default: { - readonly accessScope: { - readonly key: "accessScope"; - readonly endpoints: readonly ["list"]; - readonly children: {}; - }; - readonly apiPermission: { - readonly key: "apiPermission"; - readonly endpoints: readonly ["delete"]; - readonly children: {}; - }; - readonly applicationCharge: { - readonly key: "applicationCharge"; - readonly endpoints: readonly ["create", "get", "list", "activate"]; - readonly children: {}; - }; - readonly applicationCredit: { - readonly key: "applicationCredit"; - readonly endpoints: readonly ["create", "get", "list"]; - readonly children: {}; - }; - readonly balance: { - readonly key: "balance"; - readonly endpoints: readonly ["list", "transactions"]; - readonly children: {}; - }; - readonly blog: { - readonly key: "blog"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: { - readonly article: { - readonly key: "article"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update", "authors", "tags"]; - readonly children: {}; - }; - }; - }; - readonly carrierService: { - readonly key: "carrierService"; - readonly endpoints: readonly ["create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly checkout: { - readonly key: "checkout"; - readonly endpoints: readonly ["count", "create", "get", "list", "update", "complete", "shippingRates"]; - readonly children: { - readonly payment: { - readonly key: "payment"; - readonly endpoints: readonly ["count", "create", "get", "list"]; - readonly children: {}; - }; - }; - }; - readonly collect: { - readonly key: "collect"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list"]; - readonly children: {}; - }; - readonly collectionListing: { - readonly key: "collectionListing"; - readonly endpoints: readonly ["get", "list", "productIds"]; - readonly children: {}; - }; - readonly collection: { - readonly key: "collection"; - readonly endpoints: readonly ["get", "products"]; - readonly children: {}; - }; - readonly comment: { - readonly key: "comment"; - readonly endpoints: readonly ["count", "create", "get", "list", "update", "spam", "notSpam", "approve", "remove", "restore"]; - readonly children: {}; - }; - readonly country: { - readonly key: "country"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: { - readonly province: { - readonly key: "province"; - readonly endpoints: readonly ["count", "get", "list", "update"]; - readonly children: {}; - }; - }; - }; - readonly currency: { - readonly key: "currency"; - readonly endpoints: readonly ["list"]; - readonly children: {}; - }; - readonly customCollection: { - readonly key: "customCollection"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly customerSavedSearch: { - readonly key: "customerSavedSearch"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update", "customers"]; - readonly children: {}; - }; - readonly customer: { - readonly key: "customer"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update", "search", "accountActivationUrl", "sendInvite", "orders"]; - readonly children: { - readonly customerAddress: { - readonly key: "customerAddress"; - readonly endpoints: readonly ["delete", "get", "list", "create", "update", "set", "default"]; - readonly children: {}; - }; - }; - }; - readonly dispute: { - readonly key: "dispute"; - readonly endpoints: readonly ["get", "list"]; - readonly children: {}; - }; - readonly draftOrder: { - readonly key: "draftOrder"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update", "complete", "sendInvoice"]; - readonly children: {}; - }; - readonly fulfillmentEvent: { - readonly key: "fulfillmentEvent"; - readonly endpoints: readonly ["list", "get", "create", "update", "delete"]; - readonly children: {}; - }; - readonly fulfillmentOrder: { - readonly key: "fulfillmentOrder"; - readonly endpoints: readonly ["get", "list", "cancel", "close", "move", "locationsForMove"]; - readonly children: { - readonly cancellationRequest: { - readonly key: "cancellationRequest"; - readonly endpoints: readonly ["create", "accept", "reject"]; - readonly children: {}; - }; - readonly fulfillmentRequest: { - readonly key: "fulfillmentRequest"; - readonly endpoints: readonly ["create", "accept", "reject"]; - readonly children: {}; - }; - }; - }; - readonly fulfillmentService: { - readonly key: "fulfillmentService"; - readonly endpoints: readonly ["create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly giftCard: { - readonly key: "giftCard"; - readonly endpoints: readonly ["count", "create", "get", "list", "update", "disable", "search"]; - readonly children: { - readonly giftCardAdjustment: { - readonly key: "giftCardAdjustment"; - readonly endpoints: readonly ["create", "get", "list"]; - readonly children: {}; - }; - }; - }; - readonly inventoryItem: { - readonly key: "inventoryItem"; - readonly endpoints: readonly ["get", "list", "update"]; - readonly children: {}; - }; - readonly inventoryLevel: { - readonly key: "inventoryLevel"; - readonly endpoints: readonly ["list", "adjust", "connect", "delete", "set"]; - readonly children: {}; - }; - readonly location: { - readonly key: "location"; - readonly endpoints: readonly ["count", "get", "list", "inventoryLevels"]; - readonly children: {}; - }; - readonly marketingEvent: { - readonly key: "marketingEvent"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update", "engagements"]; - readonly children: {}; - }; - readonly metafield: { - readonly key: "metafield"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly order: { - readonly key: "order"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update", "close", "open", "cancel", "fulfillmentOrders"]; - readonly children: { - readonly fulfillment: { - readonly key: "fulfillment"; - readonly endpoints: readonly ["count", "create", "get", "list", "update", "complete", "open", "cancel", "createV2", "updateTracking"]; - readonly children: { - readonly fulfillmentEvent: { - readonly key: "fulfillmentEvent"; - readonly endpoints: readonly ["list", "get", "create", "update", "delete"]; - readonly children: {}; - }; - }; - }; - readonly orderRisk: { - readonly key: "orderRisk"; - readonly endpoints: readonly ["create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly refund: { - readonly key: "refund"; - readonly endpoints: readonly ["create", "get", "list", "calculate"]; - readonly children: {}; - }; - readonly transaction: { - readonly key: "transaction"; - readonly endpoints: readonly ["count", "create", "get", "list"]; - readonly children: {}; - }; - }; - }; - readonly page: { - readonly key: "page"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly payout: { - readonly key: "payout"; - readonly endpoints: readonly ["get", "list"]; - readonly children: {}; - }; - readonly policy: { - readonly key: "policy"; - readonly endpoints: readonly ["list"]; - readonly children: {}; - }; - readonly priceRule: { - readonly key: "priceRule"; - readonly endpoints: readonly ["create", "delete", "get", "list", "update"]; - readonly children: { - readonly discountCodeCreationJob: { - readonly key: "discountCodeCreationJob"; - readonly endpoints: readonly ["get", "create", "discountCodes"]; - readonly children: {}; - }; - readonly discountCode: { - readonly key: "discountCode"; - readonly endpoints: readonly ["create", "delete", "get", "list", "update", "lookup"]; - readonly children: {}; - }; - }; - }; - readonly productListing: { - readonly key: "productListing"; - readonly endpoints: readonly ["count", "delete", "get", "list", "create", "productIds"]; - readonly children: {}; - }; - readonly product: { - readonly key: "product"; - readonly endpoints: readonly ["delete", "count", "get", "create", "list", "update"]; - readonly children: { - readonly productImage: { - readonly key: "productImage"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly productResourceFeedback: { - readonly key: "resourceFeedback"; - readonly endpoints: readonly ["create", "list"]; - readonly children: {}; - }; - readonly productVariant: { - readonly key: "productVariant"; - readonly endpoints: readonly ["count", "delete", "get", "create", "list", "update"]; - readonly children: {}; - }; - }; - }; - readonly recurringApplicationCharge: { - readonly key: "recurringApplicationCharge"; - readonly endpoints: readonly ["create", "delete", "get", "list", "activate", "customize"]; - readonly children: { - readonly usageCharge: { - readonly key: "usageCharge"; - readonly endpoints: readonly ["create", "get", "list"]; - readonly children: {}; - }; - }; - }; - readonly redirect: { - readonly key: "redirect"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly report: { - readonly key: "report"; - readonly endpoints: readonly ["create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly resourceFeedback: { - readonly key: "resourceFeedback"; - readonly endpoints: readonly ["create", "list"]; - readonly children: {}; - }; - readonly scriptTag: { - readonly key: "scriptTag"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: {}; - }; - readonly shippingZone: { - readonly key: "shippingZone"; - readonly endpoints: readonly ["list"]; - readonly children: {}; - }; - readonly shop: { - readonly key: "shop"; - readonly endpoints: readonly ["get"]; - readonly children: {}; - }; - readonly smartCollection: { - readonly key: "smartCollection"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update", "order", "products"]; - readonly children: {}; - }; - readonly storefrontAccessToken: { - readonly key: "storefrontAccessToken"; - readonly endpoints: readonly ["create", "delete", "list"]; - readonly children: {}; - }; - readonly tenderTransaction: { - readonly key: "tenderTransaction"; - readonly endpoints: readonly ["list"]; - readonly children: {}; - }; - readonly theme: { - readonly key: "theme"; - readonly endpoints: readonly ["create", "delete", "get", "list", "update"]; - readonly children: { - readonly asset: { - readonly key: "asset"; - readonly endpoints: readonly ["list", "get", "create", "update", "delete"]; - readonly children: {}; - }; - }; - }; - readonly user: { - readonly key: "user"; - readonly endpoints: readonly ["get", "list", "current"]; - readonly children: {}; - }; - readonly webhook: { - readonly key: "webhook"; - readonly endpoints: readonly ["count", "create", "delete", "get", "list", "update"]; - readonly children: {}; - }; -}; -export default _default; diff --git a/lib/connectors/shopify/resource-inference/inferred-resources.js b/lib/connectors/shopify/resource-inference/inferred-resources.js deleted file mode 100644 index 8574250..0000000 --- a/lib/connectors/shopify/resource-inference/inferred-resources.js +++ /dev/null @@ -1,395 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = { - accessScope: { - key: "accessScope", - endpoints: ["list"], - children: {}, - }, - apiPermission: { - key: "apiPermission", - endpoints: ["delete"], - children: {}, - }, - applicationCharge: { - key: "applicationCharge", - endpoints: ["create", "get", "list", "activate"], - children: {}, - }, - applicationCredit: { - key: "applicationCredit", - endpoints: ["create", "get", "list"], - children: {}, - }, - balance: { - key: "balance", - endpoints: ["list", "transactions"], - children: {}, - }, - blog: { - key: "blog", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: { - article: { - key: "article", - endpoints: ["count", "create", "delete", "get", "list", "update", "authors", "tags"], - children: {}, - }, - }, - }, - carrierService: { - key: "carrierService", - endpoints: ["create", "delete", "get", "list", "update"], - children: {}, - }, - checkout: { - key: "checkout", - endpoints: ["count", "create", "get", "list", "update", "complete", "shippingRates"], - children: { - payment: { - key: "payment", - endpoints: ["count", "create", "get", "list"], - children: {}, - }, - }, - }, - collect: { - key: "collect", - endpoints: ["count", "create", "delete", "get", "list"], - children: {}, - }, - collectionListing: { - key: "collectionListing", - endpoints: ["get", "list", "productIds"], - children: {}, - }, - collection: { - key: "collection", - endpoints: ["get", "products"], - children: {}, - }, - comment: { - key: "comment", - endpoints: [ - "count", - "create", - "get", - "list", - "update", - "spam", - "notSpam", - "approve", - "remove", - "restore", - ], - children: {}, - }, - country: { - key: "country", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: { - province: { - key: "province", - endpoints: ["count", "get", "list", "update"], - children: {}, - }, - }, - }, - currency: { - key: "currency", - endpoints: ["list"], - children: {}, - }, - customCollection: { - key: "customCollection", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: {}, - }, - customerSavedSearch: { - key: "customerSavedSearch", - endpoints: ["count", "create", "delete", "get", "list", "update", "customers"], - children: {}, - }, - customer: { - key: "customer", - endpoints: [ - "count", - "create", - "delete", - "get", - "list", - "update", - "search", - "accountActivationUrl", - "sendInvite", - "orders", - ], - children: { - customerAddress: { - key: "customerAddress", - endpoints: ["delete", "get", "list", "create", "update", "set", "default"], - children: {}, - }, - }, - }, - dispute: { - key: "dispute", - endpoints: ["get", "list"], - children: {}, - }, - draftOrder: { - key: "draftOrder", - endpoints: ["count", "create", "delete", "get", "list", "update", "complete", "sendInvoice"], - children: {}, - }, - fulfillmentEvent: { - key: "fulfillmentEvent", - endpoints: ["list", "get", "create", "update", "delete"], - children: {}, - }, - fulfillmentOrder: { - key: "fulfillmentOrder", - endpoints: ["get", "list", "cancel", "close", "move", "locationsForMove"], - children: { - cancellationRequest: { - key: "cancellationRequest", - endpoints: ["create", "accept", "reject"], - children: {}, - }, - fulfillmentRequest: { - key: "fulfillmentRequest", - endpoints: ["create", "accept", "reject"], - children: {}, - }, - }, - }, - fulfillmentService: { - key: "fulfillmentService", - endpoints: ["create", "delete", "get", "list", "update"], - children: {}, - }, - giftCard: { - key: "giftCard", - endpoints: ["count", "create", "get", "list", "update", "disable", "search"], - children: { - giftCardAdjustment: { - key: "giftCardAdjustment", - endpoints: ["create", "get", "list"], - children: {}, - }, - }, - }, - inventoryItem: { - key: "inventoryItem", - endpoints: ["get", "list", "update"], - children: {}, - }, - inventoryLevel: { - key: "inventoryLevel", - endpoints: ["list", "adjust", "connect", "delete", "set"], - children: {}, - }, - location: { - key: "location", - endpoints: ["count", "get", "list", "inventoryLevels"], - children: {}, - }, - marketingEvent: { - key: "marketingEvent", - endpoints: ["count", "create", "delete", "get", "list", "update", "engagements"], - children: {}, - }, - metafield: { - key: "metafield", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: {}, - }, - order: { - key: "order", - endpoints: [ - "count", - "create", - "delete", - "get", - "list", - "update", - "close", - "open", - "cancel", - "fulfillmentOrders", - ], - children: { - fulfillment: { - key: "fulfillment", - endpoints: [ - "count", - "create", - "get", - "list", - "update", - "complete", - "open", - "cancel", - "createV2", - "updateTracking", - ], - children: { - fulfillmentEvent: { - key: "fulfillmentEvent", - endpoints: ["list", "get", "create", "update", "delete"], - children: {}, - }, - }, - }, - orderRisk: { - key: "orderRisk", - endpoints: ["create", "delete", "get", "list", "update"], - children: {}, - }, - refund: { - key: "refund", - endpoints: ["create", "get", "list", "calculate"], - children: {}, - }, - transaction: { - key: "transaction", - endpoints: ["count", "create", "get", "list"], - children: {}, - }, - }, - }, - page: { - key: "page", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: {}, - }, - payout: { - key: "payout", - endpoints: ["get", "list"], - children: {}, - }, - policy: { - key: "policy", - endpoints: ["list"], - children: {}, - }, - priceRule: { - key: "priceRule", - endpoints: ["create", "delete", "get", "list", "update"], - children: { - discountCodeCreationJob: { - key: "discountCodeCreationJob", - endpoints: ["get", "create", "discountCodes"], - children: {}, - }, - discountCode: { - key: "discountCode", - endpoints: ["create", "delete", "get", "list", "update", "lookup"], - children: {}, - }, - }, - }, - productListing: { - key: "productListing", - endpoints: ["count", "delete", "get", "list", "create", "productIds"], - children: {}, - }, - product: { - key: "product", - endpoints: ["delete", "count", "get", "create", "list", "update"], - children: { - productImage: { - key: "productImage", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: {}, - }, - productResourceFeedback: { - key: "resourceFeedback", - endpoints: ["create", "list"], - children: {}, - }, - productVariant: { - key: "productVariant", - endpoints: ["count", "delete", "get", "create", "list", "update"], - children: {}, - }, - }, - }, - recurringApplicationCharge: { - key: "recurringApplicationCharge", - endpoints: ["create", "delete", "get", "list", "activate", "customize"], - children: { - usageCharge: { - key: "usageCharge", - endpoints: ["create", "get", "list"], - children: {}, - }, - }, - }, - redirect: { - key: "redirect", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: {}, - }, - report: { - key: "report", - endpoints: ["create", "delete", "get", "list", "update"], - children: {}, - }, - resourceFeedback: { - key: "resourceFeedback", - endpoints: ["create", "list"], - children: {}, - }, - scriptTag: { - key: "scriptTag", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: {}, - }, - shippingZone: { - key: "shippingZone", - endpoints: ["list"], - children: {}, - }, - shop: { - key: "shop", - endpoints: ["get"], - children: {}, - }, - smartCollection: { - key: "smartCollection", - endpoints: ["count", "create", "delete", "get", "list", "update", "order", "products"], - children: {}, - }, - storefrontAccessToken: { - key: "storefrontAccessToken", - endpoints: ["create", "delete", "list"], - children: {}, - }, - tenderTransaction: { - key: "tenderTransaction", - endpoints: ["list"], - children: {}, - }, - theme: { - key: "theme", - endpoints: ["create", "delete", "get", "list", "update"], - children: { - asset: { - key: "asset", - endpoints: ["list", "get", "create", "update", "delete"], - children: {}, - }, - }, - }, - user: { - key: "user", - endpoints: ["get", "list", "current"], - children: {}, - }, - webhook: { - key: "webhook", - endpoints: ["count", "create", "delete", "get", "list", "update"], - children: {}, - }, -}; diff --git a/lib/framework/application.d.ts b/lib/framework/application.d.ts deleted file mode 100644 index 100a2ea..0000000 --- a/lib/framework/application.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ConnectorScope } from "./connector"; -import { ConfigRepository } from "./config-repository"; -import { Connector, ScopeRef } from "./connector"; -export declare type ApplicationConfig = { - readonly configRepository: ConfigRepository; - readonly connectors: Readonly>; -}; -export declare class Application { - constructor({ configRepository, connectors }: ApplicationConfig); - readonly configRepository: ConfigRepository; - readonly connectors: Readonly>; - listScopes(): Promise; - requireScope(scopeRef: ScopeRef): Promise; - getScope(scopeRef: ScopeRef): Promise; -} diff --git a/lib/framework/application.js b/lib/framework/application.js deleted file mode 100644 index 950bfc6..0000000 --- a/lib/framework/application.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Application = void 0; -const connector_1 = require("./connector"); -const watch_1 = require("./watch"); -const ramda_1 = __importDefault(require("ramda")); -class Application { - constructor({ configRepository, connectors }) { - this.configRepository = configRepository; - this.connectors = connectors; - } - async listScopes() { - const singletonScopes = Object.entries(this.connectors) - .filter(([, connector]) => !connectorRequiresScopeConfig(connector)) - .map(([name]) => ({ connector: name, scope: null })); - const configuredScopes = await this.configRepository.getScopes(); - return [...singletonScopes, ...configuredScopes]; - } - async requireScope(scopeRef) { - const maybeScope = await this.getScope(scopeRef); - if (!maybeScope) { - throw new Error(`Scope '${scopeRef.scope}' not found for connector '${scopeRef.connector}'`); - } - return maybeScope; - } - async getScope(scopeRef) { - var _a; - const connector = this.connectors[scopeRef.connector]; - if (!connector) { - throw new Error(`Connector '${scopeRef.connector}' was not found.`); - } - let config = (_a = (await this.configRepository.getConfig(scopeRef))) !== null && _a !== void 0 ? _a : null; - const configIsRequired = connectorRequiresScopeConfig(connector); - if (!config) { - if (configIsRequired) { - // config is required, but none was found - return undefined; - } - // config is not required for this connector - } - let configTimestamp = Date.now(); - let refreshing = false; - const configRef = new connector_1.MutableReference(() => { - if (!refreshing) { - const configAge = Date.now() - configTimestamp; - if (configAge > configTtl) { - refreshing = true; - this.configRepository - .getConfig(scopeRef) - .then(latestConfig => { - if (!ramda_1.default.equals(config, latestConfig)) { - config = latestConfig; - } - configTimestamp = Date.now(); - }) - .finally(() => (refreshing = false)); - } - } - if (configIsRequired && !config) { - throw new Error(`Connector '${scopeRef.connector}' scope '${scopeRef.scope}' has been disabled.`); - } - return config; - }, newConfig => { - this.configRepository.setConfig(scopeRef, newConfig); - config = newConfig; - configTimestamp = Date.now(); - }); - const configSchema = connector.$definition.configSchema; - const scope = connector(configRef.withSchema(configSchema)); - return watch_1.watchScope(scope); - } -} -exports.Application = Application; -function connectorRequiresScopeConfig(connector) { - return !connector.$definition.configSchema.is(null); -} -const configTtl = 1000; diff --git a/lib/framework/binary-api.d.ts b/lib/framework/binary-api.d.ts deleted file mode 100644 index 15aaa70..0000000 --- a/lib/framework/binary-api.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Command, Path, ScopeRef } from "."; -import { FullyQualifiedMessageHeader, MessageHeader } from "./connector"; -export declare function decodeIncompletePath(encodedPath: string): Path; -export declare function decodeFQHeader(encodedHeader: string): FullyQualifiedMessageHeader; -export declare function decodeHeader(encodedHeader: string): MessageHeader; -export declare function encodeHeader({ scope, path, endpoint, }: Partial): string; -export declare function decodeCommand(encodedCommand: string): Command; -export declare function decodeCommandInput(encodedInput: string): any; -export declare function decodeScope(encodedScopeRef: string): ScopeRef; -export declare function decodeConnectorName(encodedConnectorName: string): string; -export declare function encodeConnectorName(connectorName: string): string; diff --git a/lib/framework/binary-api.js b/lib/framework/binary-api.js deleted file mode 100644 index f62e603..0000000 --- a/lib/framework/binary-api.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.encodeConnectorName = exports.decodeConnectorName = exports.decodeScope = exports.decodeCommandInput = exports.decodeCommand = exports.encodeHeader = exports.decodeHeader = exports.decodeFQHeader = exports.decodeIncompletePath = void 0; -const json5_1 = __importDefault(require("json5")); -const PATH_SEPARATOR = "."; -function decodeIncompletePath(encodedPath) { - const [head, tail] = decodeMaybeIncompletePath(encodedPath); - return tail === undefined ? head : [...head, tail]; -} -exports.decodeIncompletePath = decodeIncompletePath; -function decodeFQHeader(encodedHeader) { - const [connectorAndScope, ...path] = decodePath(encodedHeader); - const endpoint = path.pop(); - if (!(path.length > 0 && typeof endpoint === "string")) { - throw new Error(); - } - const scope = Array.isArray(connectorAndScope) - ? { - connector: getConnectorName(connectorAndScope[0]), - scope: connectorAndScope[1], - } - : { - connector: getConnectorName(connectorAndScope), - scope: "", - }; - return { scope, path, endpoint }; -} -exports.decodeFQHeader = decodeFQHeader; -function decodeHeader(encodedHeader) { - const path = decodePath(encodedHeader); - const endpoint = path.pop(); - if (!(path.length > 0 && typeof endpoint === "string")) { - throw new Error(); - } - return { path, endpoint }; -} -exports.decodeHeader = decodeHeader; -function encodeHeader({ scope, path, endpoint, }) { - return encodePath([ - (scope === null || scope === void 0 ? void 0 : scope.scope) ? [scope.connector, scope.scope] : scope === null || scope === void 0 ? void 0 : scope.connector, - ...(path !== null && path !== void 0 ? path : []), - endpoint, - ].filter(Boolean)); -} -exports.encodeHeader = encodeHeader; -function decodeCommand(encodedCommand) { - const [encodedHeader, ...encodedInputParts] = encodedCommand.split(" "); - const encodedInput = encodedInputParts.join(" "); - return { - ...decodeHeader(encodedHeader), - input: encodedInput ? decodeCommandInput(encodedInput) : undefined, - }; -} -exports.decodeCommand = decodeCommand; -function decodeCommandInput(encodedInput) { - return json5_1.default.parse(encodedInput); -} -exports.decodeCommandInput = decodeCommandInput; -function decodeScope(encodedScopeRef) { - const pathEl = decodePathElement(encodedScopeRef); - return Array.isArray(pathEl) - ? { - connector: getConnectorName(pathEl[0]), - scope: pathEl[1], - } - : { - connector: getConnectorName(pathEl), - scope: "", - }; -} -exports.decodeScope = decodeScope; -function decodeConnectorName(encodedConnectorName) { - const connectorIdentifier = decodeIdentifier(encodedConnectorName); - return getConnectorName(connectorIdentifier); -} -exports.decodeConnectorName = decodeConnectorName; -function encodeConnectorName(connectorName) { - return encodeIdentifier(getConnectorIdentifier(connectorName)); -} -exports.encodeConnectorName = encodeConnectorName; -function decodePath(encodedPath) { - const [path, tail] = decodeMaybeIncompletePath(encodedPath); - if (tail === undefined) { - return path; - } - throw new Error(`Invalid path '${encodedPath}'.`); -} -function decodeMaybeIncompletePath(encodedPath) { - let remaining = encodedPath; - const elements = []; - while (remaining.length > 0) { - const match = remaining.match(/^((?:[^.[\]]+)(?:\[[^\]]*\])?)[.$]*/); - if (!match) { - return [elements, remaining]; - } - elements.push(decodePathElement(match[1])); - remaining = remaining.slice(match[0].length); - } - return [elements]; -} -function encodePath(path) { - try { - const encodedPathElements = path.map(encodePathElement); - return encodedPathElements.join(PATH_SEPARATOR); - } - catch (e) { - console.log({ path }); - throw e; - } -} -function decodePathElement(encodedPathElement) { - const match = /(^.*)\[(.*)\]$/.exec(encodedPathElement); - if (match) { - return [decodeIdentifier(match[1]), match[2]]; - } - return decodeIdentifier(encodedPathElement); -} -function encodePathElement(pathElement) { - if (typeof pathElement === "string") { - return encodeIdentifier(pathElement); - } - return `${encodeIdentifier(pathElement[0])}[${pathElement[1]}]`; -} -function getConnectorName(connectorIdentifier) { - return connectorIdentifier; - //return connectorAliases[connectorIdentifier] ?? connectorIdentifier; -} -function getConnectorIdentifier(connectorName) { - return connectorName; - //const alias = Object.entries(connectorAliases).find(([_, name]) => name === connectorName)?.[0]; - //return alias ?? connectorName; -} -function encodeIdentifier(identifier) { - return hyphenate(identifier); -} -function decodeIdentifier(encodedIdentifier) { - return camelCase(encodedIdentifier); -} -const hyphenate = (value) => value.replace(/([A-Z])/g, g => `-${g[0].toLowerCase()}`).replace(/_/g, "-"); -const camelCase = (value) => value.replace(/^[A-Z]/, g => g.toLowerCase()).replace(/[-_][a-z]/g, g => g[1].toUpperCase()); diff --git a/lib/framework/config-repository.d.ts b/lib/framework/config-repository.d.ts deleted file mode 100644 index 367c384..0000000 --- a/lib/framework/config-repository.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import Conf from "conf"; -import { ScopeRef } from "./connector"; -export interface ConfigRepository { - getScopes(): Promise; - getConfig(scope: ScopeRef): Promise; - setConfig(scope: ScopeRef, config: T): Promise; - removeConfig(scope: ScopeRef): Promise; - export(): Promise; - import(config: Config): Promise; -} -export declare class LocalConfigRepository implements ConfigRepository { - private conf; - constructor(conf: Conf); - getScopes(): Promise; - getConfig(scope: ScopeRef): Promise; - setConfig(scope: ScopeRef, config: any): Promise; - removeConfig(scope: ScopeRef): Promise; - export(): Promise; - import(config: any): Promise; - private scopeKey; - private computeKey; - private readonly connectorsPath; -} -export declare type Config = { - [connector: string]: { - [scope: string]: any; - }; -}; diff --git a/lib/framework/config-repository.js b/lib/framework/config-repository.js deleted file mode 100644 index 689c31b..0000000 --- a/lib/framework/config-repository.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LocalConfigRepository = void 0; -const ramda_1 = __importDefault(require("ramda")); -const json_pipe_1 = require("@space48/json-pipe"); -class LocalConfigRepository { - constructor(conf) { - this.conf = conf; - this.connectorsPath = ["connectors"]; - } - async getScopes() { - const key = this.computeKey(this.connectorsPath); - return json_pipe_1.pipe(key.length ? this.conf.get(key) : this.conf.store, ramda_1.default.toPairs, ramda_1.default.map(([connectorName, scopeConfigs]) => ramda_1.default.keys(scopeConfigs).map((scopeName) => ({ - connector: connectorName, - scope: scopeName, - }))), ramda_1.default.flatten); - } - async getConfig(scope) { - const key = this.scopeKey(scope); - return this.conf.get(key, undefined); - } - async setConfig(scope, config) { - const key = this.scopeKey(scope); - this.conf.set(key, config); - } - async removeConfig(scope) { - const key = this.scopeKey(scope); - const exists = this.conf.has(key); - if (exists) { - this.conf.delete(key); - } - return exists; - } - async export() { - return this.conf.store; - } - async import(config) { - return Promise.resolve(); - } - scopeKey(scopeRef) { - var _a; - return this.computeKey([...this.connectorsPath, scopeRef.connector, (_a = scopeRef.scope) !== null && _a !== void 0 ? _a : ""]); - } - computeKey(path) { - return path.map(rawKey => rawKey.replace(/\./g, "\\.")).join("."); - } -} -exports.LocalConfigRepository = LocalConfigRepository; diff --git a/lib/framework/connector.d.ts b/lib/framework/connector.d.ts deleted file mode 100644 index 497782c..0000000 --- a/lib/framework/connector.d.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { FlatMapAsyncOptions, Transform } from "@space48/json-pipe"; -import * as t from "io-ts"; -export declare function connector>(definition: ConnectorDefinition): Connector; -export declare type ScopeRef = { - connector: string; - scope: string | null; -}; -/** - * this function can help with type inference in connectors -- don't use unless necessary for type inference - */ -export declare function resource(resource: T): T; -export declare function resourceMerger(): , R1 extends ResourceDefinitionMap, D1 extends DocumentDefinition, E2 extends EndpointDefinitionMap, R2 extends ResourceDefinitionMap, D2 extends DocumentDefinition>(r1: ResourceDefinition, r2: ResourceDefinition) => ResourceDefinition; -/** - * A definition of a connector describing the required configuration and available - * endpoints for that connector. - */ -export interface ConnectorDefinition = ResourceDefinitionMap> { - /** - * Schema describing config required by this connector, e.g. authentication, - * concurrency, etc. - */ - readonly configSchema: t.Type; - /** - * Resources available on this connector - */ - readonly resources: Resources; - /** - * An example of a resource name to be used when generating docs. See existing - * connectors for examples. - */ - readonly scopeNameExample: string | null; - /** - * Create a "scope" which can be used to execute commands against this connector. - * - * Scope will typically be some kind of HTTP client which is updated whenever the - * config changes. (E.g. when a user modifies the config while a long running process - * is running, such as changing a concurrency limit.) - */ - getScope(config: MutableReference): Scope; - /** - * Given a scope config, returns a unique name for the scope. E.g. this might be - * a base URL in the case of Magento or a shop identifier in the case of Shopify. - */ - getScopeName(config: Config): string; - /** - * Returns a warning message to be shown to a user before they execute commands - * against this scope. For example, this might be a message warning the user that - * the given scope relates to a production instance. - */ - getWarningMessage(scope: Scope): Promise; -} -export declare type Connector = Record> = ResourceMap & { - $definition: ConnectorDefinition; - (config: Config | MutableReference): ConnectorScope; -}; -export interface ConnectorScope { - scopeName: string; - connector: Connector; - getWarningMessage(): Promise; - execute(command: Command): AsyncIterable; - execute(command: Command): AsyncIterable>; - execute(command: Command): AsyncIterable>; - execute(commands: AnyIterable): AsyncIterable>; -} -/** - * This type is distributive, so - * InferOutputElement | Command | State | State> - * will yield - * OutputElement | OutputElement | State | State - */ -declare type InferOutputElement = Input extends Command ? OutputElement : Input extends State ? State : never; -export interface ResourceDefinitionMap { - readonly [key: string]: ResourceDefinition; -} -export declare type ResourceMap = { - ___foobar: never; -} extends T ? Record : { - [K in keyof T]: T[K] extends object & ResourceDefinition ? Resource : never; -}; -export interface ResourceDefinition = EndpointDefinitionMap, Resources extends ResourceDefinitionMap = ResourceDefinitionMap, Documents extends DocumentDefinition = DocumentDefinition> { - readonly endpoints?: Endpoints; - readonly resources?: Resources; - readonly documents?: Documents; -} -declare type Resource = ResourceMap & EndpointMap & DocumentSelectors; -interface DocumentSelectors { - $all: Document; - $doc(id: DocId): Document; -} -export interface DocumentDefinition { - idField?: string; - listIds?(scope: Scope): (path: Path) => AsyncIterable; - readonly endpoints?: EndpointDefinitionMap; - readonly resources?: ResourceDefinitionMap; -} -declare type Document = (T["resources"] extends ResourceDefinitionMap ? ResourceMap : Record) & (T["endpoints"] extends EndpointDefinitionMap ? EndpointMap : Record); -export interface EndpointDefinitionMap { - readonly [key: string]: EndpointDefinition; -} -declare type EndpointMap = { - [K in keyof T]: T[K] extends object ? Endpoint : never; -}; -export interface EndpointDefinition { - (scope: Scope): EndpointFn; -} -export interface EndpointFn { - (input: EndpointPayload): Promise | AsyncIterable; -} -export interface EndpointPayload { - readonly path: Path; - readonly docId: DocId[]; - readonly input: T; -} -export declare type DocId = number | string; -declare type Endpoint = T extends EndpointDefinition ? undefined extends InT ? OptionalInputEndpointFns : MandatoryInputEndpointFns : never; -interface OptionalInputEndpointFns { - (input?: InT): Command; -} -interface MandatoryInputEndpointFns { - (input: InT): Command; -} -export interface State { - state: T; -} -export interface Command extends MessageHeader { - input: InT; - __dummyProps?: { - outT: OutT; - multiPath: MultiPath; - }; -} -export interface FullyQualifiedMessageHeader extends MessageHeader { - scope: ScopeRef; -} -export interface MessageHeader { - path: Path; - endpoint: string; -} -export interface OutputWithPath { - path: Path; - output: T; -} -export interface OutputElement extends MessageHeader { - input: InT; - output?: OutT; - success: boolean; - error?: any; -} -export declare type Path = Path.Element[]; -export declare namespace Path { - const WILDCARD = "*"; - type DocIdWildcard = typeof WILDCARD; - type Element = string | [resource: string, documentId: DocId | DocIdWildcard]; - function pop(path: Path): [head: Path, tail: Path.Element | undefined]; - function computeAllHeaders(host: ConnectorDefinition | ResourceDefinition | DocumentDefinition, path?: Path): MessageHeader[]; - function containsWildcard(path: Path): boolean; - class InvalidPathError extends Error { - constructor(path: Path, message?: string); - } - function selector(resources: ResourceDefinitionMap): (path: Path) => ResourceDefinition | DocumentDefinition; - function endpointFnSelector(resources: ResourceDefinitionMap, scope: Scope): (resourcePath: Path, endpointName: string) => EndpointFn; - function endpointNamesSelector(resources: ResourceDefinitionMap): (path: Path) => string[]; - function getDocIds(path: Path): DocId[]; - /** - * Expand a path so that a path containing document ID wildcards is mapped to n paths containing document IDs only - */ - function expander(resources: ResourceDefinitionMap, scope: Scope): (path: Path) => AsyncIterable; -} -declare type AnyIterable = AsyncIterable | Iterable; -declare type CompoundReference> = 1 extends 1 ? Reference<{ - readonly [K in keyof T]: T[K] extends Reference ? U : never; -}> : never; -export declare class Reference { - readonly get: () => T; - static combine>(refs: Refs): CompoundReference; - constructor(get: () => T); - map(mapper: (config: T) => U): Reference; -} -export declare class MutableReference extends Reference { - readonly get: () => T; - readonly set: (value: T) => void; - static of(initialValue: T, schema?: t.Type): MutableReference; - constructor(get: () => T, set: (value: T) => void); - withSchema(schema: t.Type): MutableReference; -} -export declare class InvalidConnectorDefinition extends Error { -} -export declare class InvalidCommand extends Error { -} -export declare class EndpointError extends Error { - readonly detail: any; - constructor(message: string, options?: { - detail?: any; - }); - normalize(): { - message: string; - detail: any; - }; -} -/** - * Pipeline functions which pass State directly through, unmodified, but *in order* - * - * I.e. when input is [Input State Input], output is [Output State Output] - */ -export declare abstract class State { - private constructor(); - static of(value: T): State; - static isState(value: any): value is State; - static map(mapper: (element: InT) => OutT): Transform | InT, State | OutT>; - static tap(fn: (element: InT) => void): Transform | InT, State | InT>; - static flatMapAsync(options: FlatMapAsyncOptions, mapper: (element: InT) => AsyncIterable): Transform | InT, State | OutT>; - static collectOutputs(outputs: AsyncIterable): AsyncIterable>; - static collectOutputs(): Transform>; -} -declare type InferStatefulOutput = 1 extends 1 ? [ - state: Input extends State ? StateT : never, - ...outputs: ReadonlyArray ? OutputElement : never> -] : never; -export {}; diff --git a/lib/framework/connector.js b/lib/framework/connector.js deleted file mode 100644 index 93810ea..0000000 --- a/lib/framework/connector.js +++ /dev/null @@ -1,457 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.State = exports.EndpointError = exports.InvalidCommand = exports.InvalidConnectorDefinition = exports.MutableReference = exports.Reference = exports.Path = exports.resourceMerger = exports.resource = exports.connector = void 0; -const json_pipe_1 = require("@space48/json-pipe"); -const PathReporter_1 = require("io-ts/lib/PathReporter"); -const ramda_1 = __importDefault(require("ramda")); -function connector(definition) { - try { - const resources = resourceMap(definition.resources, []); - //eslint-disable-next-line no-inner-declarations - function scopeFactory(configArg) { - const config = configArg instanceof MutableReference - ? configArg - : MutableReference.of(configArg, definition.configSchema); - const _scope = definition.getScope(config); - const executeCommands = commandExecutor(definition.resources, _scope); - return { - scopeName: definition.getScopeName(config.get()), - connector, - async getWarningMessage() { - var _a; - return await ((_a = definition.getWarningMessage) === null || _a === void 0 ? void 0 : _a.call(definition, _scope)); - }, - async *execute(commandOrCommands) { - if (isIterable(commandOrCommands)) { - yield* json_pipe_1.pipe(executeCommands(commandOrCommands), State.map(result => ({ - ...result, - error: result.error instanceof EndpointError - ? result.error.normalize() - : result.error instanceof Error - ? result.error.message - : result.error, - }))); - } - else { - const pathContainsWildcard = Path.containsWildcard(commandOrCommands.path); - const outputElements = executeCommands([commandOrCommands]); - if (pathContainsWildcard) { - yield* json_pipe_1.pipe(outputElements, State.tap(({ success, error }) => { - if (!success) { - if (error instanceof Error) { - throw error; - } - throw Error(error); - } - }), State.map((outputElement) => ({ - path: outputElement.path, - output: outputElement.output, - }))); - } - else { - yield* json_pipe_1.pipe(outputElements, State.tap(({ success, error }) => { - if (!success) { - if (error instanceof Error) { - throw error; - } - throw Error(error); - } - }), State.map(({ output }) => output)); - } - } - }, - }; - } - const connector = addPropertiesToFunction(scopeFactory, { - ...resources, - $definition: definition, - }); - return connector; - } - catch (e) { - throw new InvalidConnectorDefinition(e); - } -} -exports.connector = connector; -/** - * this function can help with type inference in connectors -- don't use unless necessary for type inference - */ -function resource(resource) { - return resource; -} -exports.resource = resource; -function resourceMerger() { - return (r1, r2) => { - return ramda_1.default.mergeDeepRight(r1, r2); - }; -} -exports.resourceMerger = resourceMerger; -function resourceMap(resources, path) { - return ramda_1.default.mapObjIndexed((resource, name) => _resource(resource, path, name), resources); -} -function _resource(resource, path, name) { - var _a, _b, _c; - return deepMerge(deepMerge(resourceMap((_a = resource.resources) !== null && _a !== void 0 ? _a : {}, [...path, name]), endpointMap((_b = resource.endpoints) !== null && _b !== void 0 ? _b : {}, [...path, name])), { - $all: document((_c = resource.documents) !== null && _c !== void 0 ? _c : {}, [...path, [name, Path.WILDCARD]]), - $doc: (id) => { var _a; return document((_a = resource.documents) !== null && _a !== void 0 ? _a : {}, [...path, [name, id]]); }, - }); -} -function document(document, path) { - var _a, _b; - return deepMerge(resourceMap((_a = document.resources) !== null && _a !== void 0 ? _a : {}, path), endpointMap((_b = document.endpoints) !== null && _b !== void 0 ? _b : {}, path)); -} -function endpointMap(endpoints, path) { - return ramda_1.default.mapObjIndexed((_, name) => endpoint(path, name), endpoints); -} -function endpoint(path, endpoint) { - return input => ({ path, endpoint, input: input }); -} -function createValidator(schema) { - return value => { - const result = schema.decode(value); - if ("left" in result) { - throw new Error(PathReporter_1.PathReporter.report(result).join("\n")); - } - }; -} -/** - * A deep merge which will merge functions with objects where necessary - */ -function deepMerge(x, y) { - if (typeof x === "function" && typeof y === "function") { - throw new Error("Cannot merge two functions."); - } - if (typeof x === "function" && typeof y === "object") { - return addPropertiesToFunction(x, y); - } - if (typeof y === "function" && typeof x === "object") { - return addPropertiesToFunction(y, x); - } - if (typeof x === "object" && typeof y === "object") { - const keys = new Set(Object.keys(x).concat(Object.keys(y))); - const entries = [...keys].map(key => ramda_1.default.pair(key, deepMergeProperty(key, x, y))); - return ramda_1.default.fromPairs(entries); - } - throw new Error(); -} -function deepMergeProperty(property, x, y) { - if (property in x) { - return property in y ? deepMerge(x, y) : x[property]; - } - return y[property]; -} -//eslint-disable-next-line @typescript-eslint/ban-types -function addPropertiesToFunction(fn, properties) { - const result = (...args) => fn(...args); - Object.entries(properties).forEach(([key, value]) => (result[key] = value)); - return result; -} -//eslint-disable-next-line @typescript-eslint/no-namespace -var Path; -(function (Path) { - Path.WILDCARD = "*"; - function pop(path) { - const head = path.slice(0, -1); - const tail = path.slice(-1)[0]; - return [head, tail]; - } - Path.pop = pop; - //eslint-disable-next-line no-inner-declarations - function popResourceName(path) { - const [head, tail] = pop(path); - if (typeof tail !== "string") { - throw new InvalidPathError(path); - } - return [head, tail]; - } - function computeAllHeaders(host, path = []) { - var _a, _b, _c, _d, _e, _f; - const endpointNames = "endpoints" in host ? Object.keys((_a = host.endpoints) !== null && _a !== void 0 ? _a : {}) : []; - const headers = endpointNames.map(endpoint => ({ path, endpoint })); - const resources = "resources" in host ? Object.entries((_b = host.resources) !== null && _b !== void 0 ? _b : {}) : []; - let documentPaths; - if ("documents" in host) { - const supportsDocIdWildcard = ((_c = host.documents) === null || _c === void 0 ? void 0 : _c.listIds) ? true : false; - const docIdField = (_e = (_d = host.documents) === null || _d === void 0 ? void 0 : _d.idField) !== null && _e !== void 0 ? _e : "id"; - const docIdPattern = `${docIdField}${supportsDocIdWildcard ? `|${Path.WILDCARD}` : ""}`; - const [prevPath, resourceName] = popResourceName(path); - const documentsPath = [...prevPath, [resourceName, docIdPattern]]; - documentPaths = Path.computeAllHeaders((_f = host.documents) !== null && _f !== void 0 ? _f : {}, documentsPath); - } - else { - documentPaths = []; - } - return [ - ...headers, - ...documentPaths, - ...ramda_1.default.chain(([resourceName, resource]) => Path.computeAllHeaders(resource, [...path, resourceName]), resources), - ]; - } - Path.computeAllHeaders = computeAllHeaders; - function containsWildcard(path) { - return path.some(element => Array.isArray(element) && element[1] === Path.WILDCARD); - } - Path.containsWildcard = containsWildcard; - class InvalidPathError extends Error { - constructor(path, message = "") { - super(`Invalid path ${JSON.stringify(path)}. ${message}`); - } - } - Path.InvalidPathError = InvalidPathError; - function selector(resources) { - return path => { - if (path.length === 0) { - throw new InvalidPathError(path); - } - return path.reduce((host, element) => { - var _a; - const resourceName = typeof element === "string" ? element : element[0]; - const resource = (_a = host.resources) === null || _a === void 0 ? void 0 : _a[resourceName]; - const _host = typeof element === "string" ? resource : resource === null || resource === void 0 ? void 0 : resource.documents; - if (!_host) { - throw new InvalidPathError(path); - } - return _host; - }, { resources }); - }; - } - Path.selector = selector; - function endpointFnSelector(resources, scope) { - const hostSelector = selector(resources); - return (resourcePath, endpointName) => { - var _a; - const endpointHost = hostSelector(resourcePath); - if (!((_a = endpointHost.endpoints) === null || _a === void 0 ? void 0 : _a[endpointName])) { - throw new InvalidPathError(resourcePath, `Endpoint '${endpointName}' does not exist on this resource.`); - } - const endpoint = endpointHost.endpoints[endpointName]; - return endpoint(scope); - }; - } - Path.endpointFnSelector = endpointFnSelector; - function endpointNamesSelector(resources) { - const hostSelector = selector(resources); - return path => { var _a; return Object.keys((_a = hostSelector(path).endpoints) !== null && _a !== void 0 ? _a : {}); }; - } - Path.endpointNamesSelector = endpointNamesSelector; - function getDocIds(path) { - return path.filter(element => Array.isArray(element)).map(([, docId]) => docId); - } - Path.getDocIds = getDocIds; - /** - * Expand a path so that a path containing document ID wildcards is mapped to n paths containing document IDs only - */ - function expander(resources, scope) { - return async function* (path) { - var _a, _b, _c; - let _resources = resources; - for (let i = 0; i < path.length; i++) { - const pathElement = path[i]; - if (typeof pathElement === "string") { - if (!_resources[pathElement]) { - throw new InvalidPathError(path.slice(0, i + 1), `Resource '${pathElement}' does not exist.`); - } - _resources = (_a = _resources[pathElement].resources) !== null && _a !== void 0 ? _a : {}; - continue; - } - const [resourceName, docId] = pathElement; - if (!_resources[resourceName]) { - throw new InvalidPathError(path.slice(0, i + 1), `Resource '${resourceName}' does not exist.`); - } - const documents = (_b = _resources[resourceName].documents) !== null && _b !== void 0 ? _b : {}; - if (docId === Path.WILDCARD) { - if (!documents.listIds) { - throw new InvalidPathError(path.slice(0, i + 1), "Wildcards are not supported for this resource."); - } - const listIdsPath = [...path.slice(0, i), resourceName]; - const expandPath = expander(resources, scope); - yield* json_pipe_1.pipe(documents.listIds(scope)(listIdsPath), json_pipe_1.map(docId => ramda_1.default.update(i, [resourceName, docId], path)), json_pipe_1.flatMapAsync({ concurrency: 10 }, expandPath)); - return; - } - _resources = (_c = documents.resources) !== null && _c !== void 0 ? _c : {}; - } - yield path; - }; - } - Path.expander = expander; -})(Path = exports.Path || (exports.Path = {})); -function commandExecutor(resources, scope) { - const selectEndpointFn = Path.endpointFnSelector(resources, scope); - const expandPaths = Path.expander(resources, scope); - return json_pipe_1.compose(ensureIterableIsAsync, State.flatMapAsync({ concurrency: 10 }, command => json_pipe_1.pipe(expandPaths(command.path), json_pipe_1.map(path => ({ ...command, path })))), State.flatMapAsync({ concurrency: 100 }, async function* (command) { - const endpointFn = selectEndpointFn(command.path, command.endpoint); - try { - const endpointReturnValue = endpointFn({ - input: command.input, - path: command.path, - docId: Path.getDocIds(command.path), - }); - if (isAsyncIterable(endpointReturnValue)) { - for await (const output of endpointReturnValue) { - yield { - input: command.input, - path: command.path, - endpoint: command.endpoint, - output, - success: true, - }; - } - } - else { - yield { - input: command.input, - path: command.path, - endpoint: command.endpoint, - output: await endpointReturnValue, - success: true, - }; - } - } - catch (e) { - yield { - input: command.input, - path: command.path, - endpoint: command.endpoint, - success: false, - error: e, - }; - } - })); -} -class Reference { - constructor(get) { - this.get = get; - } - static combine(refs) { - const unstablRef = new Reference(() => ramda_1.default.mapObjIndexed(ref => ref.get(), refs)); - // map will do equality checking; i.e. if the new computed value is equal to the previous one, we return the previous one - const stableRef = unstablRef.map(v => v); - return stableRef; - } - map(mapper) { - let previousInput = this.get(); - let output = mapper(previousInput); - return new Reference(() => { - const currentInput = this.get(); - if (!ramda_1.default.equals(previousInput, currentInput)) { - output = mapper(currentInput); - previousInput = currentInput; - } - return output; - }); - } -} -exports.Reference = Reference; -class MutableReference extends Reference { - constructor(get, set) { - super(get); - this.get = get; - this.set = set; - } - static of(initialValue, schema) { - let current = initialValue; - const ref = new MutableReference(() => current, value => { - current = value; - }); - return schema ? ref.withSchema(schema) : ref; - } - withSchema(schema) { - const validate = createValidator(schema); - validate(this.get()); - return new MutableReference(() => this.get(), value => { - if (ramda_1.default.equals(this.get(), value)) { - return; - } - validate(value); - this.set(value); - }); - } -} -exports.MutableReference = MutableReference; -class InvalidConnectorDefinition extends Error { -} -exports.InvalidConnectorDefinition = InvalidConnectorDefinition; -class InvalidCommand extends Error { -} -exports.InvalidCommand = InvalidCommand; -function ensureIterableIsAsync(iterable) { - if (isSyncIterable(iterable)) { - return (async function* () { - yield* iterable; - })(); - } - return iterable; -} -function isIterable(value) { - return isSyncIterable(value) || isAsyncIterable(value); -} -function isSyncIterable(value) { - return Symbol.iterator in value; -} -function isAsyncIterable(value) { - return Symbol.asyncIterator in value; -} -class EndpointError extends Error { - constructor(message, options) { - super(message); - this.detail = options === null || options === void 0 ? void 0 : options.detail; - } - normalize() { - return { - message: this.message, - detail: this.detail || undefined, - }; - } -} -exports.EndpointError = EndpointError; -/** - * Pipeline functions which pass State directly through, unmodified, but *in order* - * - * I.e. when input is [Input State Input], output is [Output State Output] - */ -class State { - constructor() { - return; - } - static of(value) { - return { state: value }; - } - static isState(value) { - return "state" in value; - } - static map(mapper) { - return json_pipe_1.map(element => (State.isState(element) ? element : mapper(element))); - } - static tap(fn) { - return json_pipe_1.tap(element => { - if (!State.isState(element)) { - fn(element); - } - }); - } - static flatMapAsync(options, mapper) { - return json_pipe_1.flatMapAsync(options, async function* (element) { - if (State.isState(element)) { - yield element; - } - else { - yield* mapper(element); - } - }); - } - static collectOutputs(outputs) { - if (!outputs) { - return State.collectOutputs; - } - return json_pipe_1.pipe(outputs, json_pipe_1.groupWhile(element => !State.isState(element)), json_pipe_1.map(([stateElement, ...elements]) => { - if (!State.isState(stateElement)) { - throw new Error("Stream must start with a `State` element in order to use `groupByState()`"); - } - return [stateElement.state, ...elements]; - })); - } -} -exports.State = State; diff --git a/lib/framework/docgen.d.ts b/lib/framework/docgen.d.ts deleted file mode 100644 index 8cc1e95..0000000 --- a/lib/framework/docgen.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ConnectorDefinition, ScopeRef } from "./connector"; -export declare class Shell { - private constructor(); - static explainInteractiveCliUsage(connector: ConnectorDefinition): string; - static explainCliUsageOnCli(connector: ConnectorDefinition, scopeRef: ScopeRef): string; - private static describeCommandsOnCli; -} -export declare class Markdown { - private constructor(); - static explainSummary(connector: ConnectorDefinition, connectorName: string): string; - static explainUsage(connector: ConnectorDefinition, connectorName: string): string; - private static describeCommands; - private static describeResourceUsage; - private static describeEndpointUsage; - private static encodeJsCommands; - private static encodeResourcePathJs; - private static getPathExcludingDocId; - private static pathTitle; - private static title; - private static contents; - private static linkToSection; -} diff --git a/lib/framework/docgen.js b/lib/framework/docgen.js deleted file mode 100644 index 2ad1b2b..0000000 --- a/lib/framework/docgen.js +++ /dev/null @@ -1,164 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Markdown = exports.Shell = void 0; -const connector_1 = require("./connector"); -const BinaryApi = __importStar(require("./binary-api")); -const ramda_1 = __importDefault(require("ramda")); -const json_pipe_1 = require("@space48/json-pipe"); -class Shell { - constructor() { - return; - } - static explainInteractiveCliUsage(connector) { - return Shell.describeCommandsOnCli(connector, "").join("\n"); - } - static explainCliUsageOnCli(connector, scopeRef) { - return Shell.describeCommandsOnCli(connector, "sdm ", scopeRef).join("\n"); - } - static describeCommandsOnCli(connector, commandPrefix, scopeRef) { - return json_pipe_1.pipe(connector_1.Path.computeAllHeaders(connector), ramda_1.default.map(header => ramda_1.default.pair(BinaryApi.encodeHeader({ scope: scopeRef, path: header.path }), BinaryApi.encodeHeader({ endpoint: header.endpoint }))), ramda_1.default.groupBy(([encodedResourcePath]) => encodedResourcePath), ramda_1.default.mapObjIndexed(ramda_1.default.map(([, encodedEndpointName]) => encodedEndpointName)), ramda_1.default.toPairs, ramda_1.default.map(([encodedResourcePath, encodedEndpointNames]) => `${commandPrefix}${encodedResourcePath}\n ↳ ${encodedEndpointNames.sort().join(", ")}\n`)); - } -} -exports.Shell = Shell; -class Markdown { - constructor() { - return; - } - static explainSummary(connector, connectorName) { - const commands = Markdown.describeCommands(1, connector, { - connector: connectorName, - scope: connector.scopeNameExample, - }); - return ` -${Markdown.title(1, connectorName)} - -${Markdown.title(2, "Resources")} - -${Markdown.contents(0, commands)} - -`; - } - static explainUsage(connector, connectorName) { - const commands = Markdown.describeCommands(1, connector, { - connector: connectorName, - scope: connector.scopeNameExample, - }); - return ` -${Markdown.title(0, "Resources")} - -${Markdown.contents(0, commands)} - -${commands} -`; - } - static describeCommands(nestingLevel, connector, scopeRef) { - return json_pipe_1.pipe(connector_1.Path.computeAllHeaders(connector), ramda_1.default.groupBy(header => { - const path = Markdown.getPathExcludingDocId(header.path); - return BinaryApi.encodeHeader({ path }); - }), groups => Object.values(groups), ramda_1.default.map(headers => Markdown.describeResourceUsage(nestingLevel, headers.map(header => ({ scope: scopeRef, ...header })))), lines => lines.join("\n")); - } - static describeResourceUsage(nestingLevel, headers) { - const headersSorted = ramda_1.default.sortBy(header => header.endpoint, headers); - const endpointUsage = headersSorted - .map(header => Markdown.describeEndpointUsage(nestingLevel + 1, header)) - .join("\n\n"); - return `${Markdown.pathTitle(nestingLevel, { - path: Markdown.getPathExcludingDocId(headers[0].path), - })} - -${Markdown.title(nestingLevel + 1, "Endpoints")} - -${Markdown.contents(nestingLevel, endpointUsage, title => title.split(".").slice(-1)[0])} - -${endpointUsage} -`; - } - static describeEndpointUsage(nestingLevel, header) { - return `${Markdown.pathTitle(nestingLevel, { path: header.path, endpoint: header.endpoint })} - -*CLI* -\`\`\`sh -$ sdm '${BinaryApi.encodeHeader(header)}' [input-as-json5] -\`\`\` - -*TypeScript* -\`\`\`javascript -${Markdown.encodeJsCommands(header) - .map(js => `const command = ${js};`) - .join("\n")} -\`\`\` -`; - } - static encodeJsCommands(header) { - const encodedResourcePaths = Markdown.encodeResourcePathJs(header.path); - return encodedResourcePaths.map(_resourcePath => `${header.scope.connector}.${_resourcePath}.${header.endpoint}(input?: unknown)`); - } - static encodeResourcePathJs(path) { - const pathWithAll = path - .map(pathEl => Array.isArray(pathEl) - ? String(pathEl[1]).includes(connector_1.Path.WILDCARD) - ? `${pathEl[0]}.$all` - : `${pathEl[0]}.$doc(${String(pathEl[1]).replace("|*", "")})` - : pathEl) - .join("."); - const pathWithDoc = path - .map(pathEl => Array.isArray(pathEl) - ? `${pathEl[0]}.$doc(${String(pathEl[1]).replace("|*", "")})` - : pathEl) - .join("."); - return pathWithAll === pathWithDoc ? [pathWithDoc] : [pathWithDoc, pathWithAll]; - } - static getPathExcludingDocId(path) { - const lastElementOfPath = path[path.length - 1]; - return Array.isArray(lastElementOfPath) ? [...path.slice(0, -1), lastElementOfPath[0]] : path; - } - static pathTitle(nestingLevel, header) { - var _a; - const encodedHeader = BinaryApi.encodeHeader({ - ...header, - path: (_a = header.path) === null || _a === void 0 ? void 0 : _a.map(pathEl => (Array.isArray(pathEl) ? [pathEl[0], ""] : pathEl)), - }); - return Markdown.title(nestingLevel, encodedHeader); - } - static title(nestingLevel, title) { - return `${"#".repeat(nestingLevel + 1)} ${title}`; - } - static contents(nestingLevel, body, titleMapper) { - return body - .split("\n") - .filter(line => line.startsWith(`${"#".repeat(nestingLevel + 2)} `)) - .map(line => line.slice(nestingLevel + 3)) - .map(sectionTitle => { - const linkTitle = titleMapper ? titleMapper(sectionTitle) : sectionTitle; - return Markdown.linkToSection(linkTitle, sectionTitle); - }) - .map(contentsTitle => ` * ${contentsTitle}`) - .join("\n"); - } - static linkToSection(linkTitle, sectionTitle) { - return `[${linkTitle}](#${sectionTitle.replace(/[[\].]/g, "")})`; - } -} -exports.Markdown = Markdown; diff --git a/lib/framework/index.d.ts b/lib/framework/index.d.ts deleted file mode 100644 index 817f78b..0000000 --- a/lib/framework/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./connector"; -export * from "./config-repository"; -export * as BinaryApi from "./binary-api"; diff --git a/lib/framework/index.js b/lib/framework/index.js deleted file mode 100644 index 8eebe14..0000000 --- a/lib/framework/index.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BinaryApi = void 0; -__exportStar(require("./connector"), exports); -__exportStar(require("./config-repository"), exports); -exports.BinaryApi = __importStar(require("./binary-api")); diff --git a/lib/framework/watch.d.ts b/lib/framework/watch.d.ts deleted file mode 100644 index 8d8cc41..0000000 --- a/lib/framework/watch.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { ConnectorScope } from "./connector"; -import { MessageHeader } from "."; -export declare function watchScope(scope: ConnectorScope): ConnectorScope; -export declare function listenForProgress(listener: (state: ProcessSnapshot[]) => void): () => void; -export declare type ProcessSnapshot = Readonly<{ - pid: number; - executions: ExecutionProgressSnapshot[]; -}>; -export declare type ExecutionProgressSnapshot = Readonly<{ - pid: number; - executionId: number; - error: string | null; - commands: CommandProgressSnapshot[]; - timestamp: Date; - startTime: Date; - finishTime: Date | null; - scope: string; -}>; -export declare type CommandProgressSnapshot = Readonly<{ - commandId: number; - command: MessageHeader; - stats: { - timestamp: Date; - outputs: number; - outputs10: number; - outputs60: number; - outputs300: number; - }; -}>; diff --git a/lib/framework/watch.js b/lib/framework/watch.js deleted file mode 100644 index cee8574..0000000 --- a/lib/framework/watch.js +++ /dev/null @@ -1,277 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.listenForProgress = exports.watchScope = void 0; -const node_ipc_1 = __importDefault(require("node-ipc")); -const _1 = require("."); -const binary_api_1 = require("./binary-api"); -function watchScope(scope) { - return { - ...scope, - execute: async function* (commands) { - const progress = Client.reportProgress(scope.scopeName, commands); - try { - for await (const output of scope.execute(commands)) { - progress.recordOutput(output); - yield output; - } - progress.finish(); - } - catch (e) { - progress.finish(e); - throw e; - } - }, - }; -} -exports.watchScope = watchScope; -function listenForProgress(listener) { - let state = []; - node_ipc_1.default.config.id = ipcId; - node_ipc_1.default.config.silent = true; - node_ipc_1.default.serve(() => { - node_ipc_1.default.server.on(MessageType.ProcessState, (serializedProcessState) => { - const processState = deserializeProcessState(serializedProcessState); - state = state.filter(({ pid }) => pid !== processState.pid).concat(processState); - listener(state); - }); - }); - node_ipc_1.default.server.start(); - setImmediate(() => listener(state)); - return () => node_ipc_1.default.server.stop(); -} -exports.listenForProgress = listenForProgress; -class Client { - static reportProgress(scope, commandOrCommands) { - Client.start(); - const progress = new ExecutionProgress(scope, commandOrCommands, process.pid, finalProgress => { - Client.activeExecutions = Client.activeExecutions.filter(_progress => _progress !== progress); - Client.finishedExecutions = [...Client.finishedExecutions, finalProgress]; - if (Client.activeExecutions.length === 0) { - Client.broadcast({ includeFinished: true }); - Client.stop(); - } - }); - this.activeExecutions.push(progress); - return progress; - } - static start() { - if (!Client.interval) { - Client.ensureSocketCreated(); - Client.interval = setInterval(() => Client.broadcast({ includeFinished: false }), 1000); - } - } - static stop() { - if (Client.interval) { - clearInterval(Client.interval); - Client.interval = undefined; - } - } - static broadcast({ includeFinished }) { - if (Client.connected) { - const timestamp = new Date(); - node_ipc_1.default.of[ipcId].emit(MessageType.ProcessState, serializeProcessState({ - pid: process.pid, - executions: [ - ...Client.activeExecutions.map(progress => progress.getSnapshot(timestamp)), - ...(includeFinished ? Client.finishedExecutions : []), - ], - })); - } - } - static ensureSocketCreated() { - if (Client.socketCreated) { - return; - } - node_ipc_1.default.config.silent = true; - node_ipc_1.default.connectTo(ipcId, () => { - node_ipc_1.default.of[ipcId].on("connect", () => { - Client.connected = true; - Client.broadcast({ includeFinished: true }); - }); - node_ipc_1.default.of[ipcId].on("disconnect", () => (Client.connected = false)); - node_ipc_1.default.of[ipcId].on("destroy", () => { - Client.connected = false; - Client.ensureSocketCreated(); - }); - }); - } -} -// note that state is mutable -Client.activeExecutions = []; -Client.finishedExecutions = []; -Client.interval = undefined; -Client.connected = false; -Client.socketCreated = false; -class ExecutionProgress { - constructor(scope, commandOrCommands, pid, onFinish) { - this.onFinish = onFinish; - this.checkpoints = []; - this.outputCount = 0; - this.commandProgresses = {}; - this.nextCommandId = 1; - this.multiCommand = isIterable(commandOrCommands); - if (!this.multiCommand) { - this.singletonCommandProgress = this.createCommandProgress(commandOrCommands); - } - this.snapshot = { - pid, - startTime: new Date(), - timestamp: new Date(), - scope, - executionId: ExecutionProgress.nextExecutionId++, - finishTime: null, - error: null, - }; - } - getSnapshot(timestamp) { - if (this.snapshot.finishTime) { - timestamp = this.snapshot.finishTime; - } - const commandProgresses = this.multiCommand - ? Object.values(this.commandProgresses) - : [this.singletonCommandProgress]; - return { - ...this.snapshot, - timestamp, - commands: commandProgresses.map(progress => progress.getSnapshot(timestamp)), - }; - } - recordOutput(output) { - if (this.multiCommand) { - const outputEl = output; - this.getCommandProgress(outputEl).recordOutput(); - } - else { - this.singletonCommandProgress.recordOutput(); - } - this.outputCount++; - } - finish(error) { - var _a; - const timestamp = new Date(); - this.snapshot = { - ...this.snapshot, - error: (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : null, - finishTime: timestamp, - }; - this.onFinish(this.getSnapshot(timestamp)); - } - getCommandProgress(outputEl) { - const strippedPath = ExecutionProgress.stripDocIds(outputEl.path); - const encodedHeader = binary_api_1.encodeHeader({ - path: strippedPath, - endpoint: outputEl.endpoint, - }); - if (!this.commandProgresses[encodedHeader]) { - this.commandProgresses[encodedHeader] = this.createCommandProgress({ - ...outputEl, - path: strippedPath, - }); - } - return this.commandProgresses[encodedHeader]; - } - createCommandProgress(messageHeader) { - return new CommandProgress({ - command: messageHeader, - commandId: this.nextCommandId++, - }); - } - static stripDocIds(path) { - return path.map(pathElement => { - if (Array.isArray(pathElement)) { - return [pathElement[0], _1.Path.WILDCARD]; - } - else { - return pathElement; - } - }); - } - getOutputsSince(unixTimestampMs) { - const index = this.checkpoints.findIndex(([checkpointTime]) => checkpointTime >= unixTimestampMs) - 1; - return index < 0 ? this.outputCount : this.outputCount - this.checkpoints[index][1]; - } -} -ExecutionProgress.nextExecutionId = 1; -class CommandProgress { - constructor(progress) { - this.progress = progress; - this.outputCount = 0; - this.checkpoints = []; - } - recordOutput() { - this.outputCount++; - } - getSnapshot(timestamp) { - const unixTimestampMs = timestamp.getTime(); - this.checkpoints = [...this.checkpoints.slice(-300), [unixTimestampMs, this.outputCount]]; - return { - ...this.progress, - stats: { - timestamp, - outputs: this.outputCount, - outputs10: this.getOutputsSince(unixTimestampMs - 10000), - outputs60: this.getOutputsSince(unixTimestampMs - 60000), - outputs300: this.getOutputsSince(unixTimestampMs - 300000), - }, - }; - } - getOutputsSince(unixTimestampMs) { - const index = this.checkpoints.findIndex(([checkpointTime]) => checkpointTime >= unixTimestampMs) - 1; - return index < 0 ? this.outputCount : this.outputCount - this.checkpoints[index][1]; - } -} -const ipcId = "sdm-watch"; -var MessageType; -(function (MessageType) { - MessageType["ProcessState"] = "process_state"; -})(MessageType || (MessageType = {})); -function serializeProcessState(state) { - return { - ...state, - executions: state.executions.map(executionProgress => { - var _a, _b; - return ({ - ...executionProgress, - startTime: executionProgress.startTime.toISOString(), - finishTime: (_b = (_a = executionProgress.finishTime) === null || _a === void 0 ? void 0 : _a.toISOString()) !== null && _b !== void 0 ? _b : null, - commands: executionProgress.commands.map(command => ({ - ...command, - stats: { - ...command.stats, - timestamp: command.stats.timestamp.toISOString(), - }, - })), - }); - }), - }; -} -function deserializeProcessState(state) { - return { - ...state, - executions: state.executions.map((executionProgress) => ({ - ...executionProgress, - startTime: new Date(executionProgress.startTime), - finishTime: executionProgress.finishTime && new Date(executionProgress.finishTime), - timestamp: new Date(executionProgress.timestamp), - commands: executionProgress.commands.map((command) => ({ - ...command, - stats: { - ...command.stats, - timestamp: new Date(command.stats.timestamp), - }, - })), - })), - }; -} -function isIterable(value) { - return isSyncIterable(value) || isAsyncIterable(value); -} -function isSyncIterable(value) { - return Symbol.iterator in value; -} -function isAsyncIterable(value) { - return Symbol.asyncIterator in value; -} diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index d4b46ae..0000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Application } from "./framework/application"; -export * from "./connectors/index"; -export * from "./framework"; -export declare function sdm(): Application; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 7bfb4ba..0000000 --- a/lib/index.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.sdm = void 0; -const conf_1 = __importDefault(require("conf")); -const connectors_1 = require("./connectors"); -const framework_1 = require("./framework"); -const application_1 = require("./framework/application"); -__exportStar(require("./connectors/index"), exports); -__exportStar(require("./framework"), exports); -function sdm() { - const configRepository = new framework_1.LocalConfigRepository(new conf_1.default()); - return new application_1.Application({ - configRepository, - connectors: { - config: connectors_1.configManagementConnector(connectors_1.regularConnectors, configRepository), - ...connectors_1.regularConnectors, - }, - }); -} -exports.sdm = sdm; diff --git a/package.json b/package.json index 2607786..9e4c97b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@space48/sdm", - "version": "0.21.0", + "version": "1.0.0", "description": "Command line tools for piping data in and out of APIs", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -20,7 +20,7 @@ "prepare": "npm run clean && npm run build -- --build tsconfig.publish.json && npm run docs" }, "engines": { - "node": ">= 10.3.0" + "node": ">= 20.0.0" }, "repository": { "type": "git", @@ -42,7 +42,7 @@ "fp-ts": "^2.9.3", "io-ts": "^2.2.13", "json5": "^2.2.0", - "node-fetch": "^2.6.7", + "node-fetch": "^3.3.2", "node-ipc": "9.1.1", "oauth": "^0.9.15", "open": "^7.0.3", @@ -55,8 +55,8 @@ "devDependencies": { "@types/bluebird": "^3.5.32", "@types/json5": "^2.2.0", - "@types/node": "^12.12.37", - "@types/node-fetch": "^2.5.6", + "@types/node": "^20.0.0", + "@types/node-fetch": "^3.0.3", "@types/node-ipc": "^9.1.3", "@types/oauth": "^0.9.1", "@types/open": "^6.2.1", @@ -90,4 +90,4 @@ "eslint --fix" ] } -} +} \ No newline at end of file diff --git a/src/connectors/big-commerce/client.ts b/src/connectors/big-commerce/client.ts index 12d4ab5..2c3f7e0 100644 --- a/src/connectors/big-commerce/client.ts +++ b/src/connectors/big-commerce/client.ts @@ -1,4 +1,4 @@ -import fetch, { RequestInit } from "node-fetch"; +import type { RequestInfo, RequestInit } from "node-fetch"; import { stringify } from "query-string"; import pRetry from "p-retry"; import * as t from "io-ts"; @@ -6,6 +6,10 @@ import { EndpointError, MutableReference } from "../../framework"; import { Agent } from "https"; import R from "ramda"; +// dynamically import node-fetch to avoid issues with ESM and CommonJS +const fetch = (...args: [RequestInfo, RequestInit?]) => + import("node-fetch").then(mod => mod.default(...args)); + const listConcurrency = 50; export type Config = t.TypeOf; @@ -137,7 +141,7 @@ export default class BigCommerce { (data.errors && JSON.stringify(data.errors) !== "{}" ? data.errors : data.title) || data, ) - .catch(), + .catch(() => `Error parsing response: ${response.statusText}`), }); } if (response.status === 204) { diff --git a/src/connectors/bundle-b2b/client.ts b/src/connectors/bundle-b2b/client.ts index 995a96b..273f112 100644 --- a/src/connectors/bundle-b2b/client.ts +++ b/src/connectors/bundle-b2b/client.ts @@ -1,4 +1,4 @@ -import fetch, { RequestInit } from "node-fetch"; +import type { RequestInfo, RequestInit } from "node-fetch"; import { stringify } from "query-string"; import pRetry from "p-retry"; import * as t from "io-ts"; @@ -6,6 +6,10 @@ import { EndpointError, MutableReference } from "../../framework"; import { Agent } from "https"; import R from "ramda"; +// dynamically import node-fetch to avoid issues with ESM and CommonJS +const fetch = (...args: [RequestInfo, RequestInit?]) => + import("node-fetch").then(mod => mod.default(...args)); + const listConcurrency = 50; export type Config = t.TypeOf; @@ -199,7 +203,7 @@ export default class BundleB2b { if (!tokenResponse.ok) { throw new Error(`Cannot refresh BundleB2B token for ${config.storeHash}`); } - const token = await tokenResponse.json(); + const token = (await tokenResponse.json()) as Token; if (token.code === 422) { throw new Error(`Cannot refresh BundleB2B token for ${config.storeHash}`); } @@ -210,6 +214,13 @@ export default class BundleB2b { } } +type Token = { + code: number; + data: { + token: string; + }; +}; + function unwrap(content: any) { return content?.data === undefined ? content : content.data; } diff --git a/src/connectors/magento1/rest.ts b/src/connectors/magento1/rest.ts index 96a7f22..6faf0d0 100644 --- a/src/connectors/magento1/rest.ts +++ b/src/connectors/magento1/rest.ts @@ -1,4 +1,4 @@ -import fetch, { RequestInit } from "node-fetch"; +import type { RequestInfo, RequestInit } from "node-fetch"; import { Agent } from "http"; import { stringify } from "query-string"; import open from "open"; @@ -10,6 +10,10 @@ import R from "ramda"; import { useAgent } from "./functions"; import { mergeUnordered, pipe } from "@space48/json-pipe"; +// dynamically import node-fetch to avoid issues with ESM and CommonJS +const fetch = (...args: [RequestInfo, RequestInit?]) => + import("node-fetch").then(mod => mod.default(...args)); + export type Magento1RestConfig = t.TypeOf; export const magento1RestConfigSchema = t.type({ @@ -143,7 +147,7 @@ export class Magento1RestClient { if (!response.ok) { throw new Error(`${response.status} ${response.statusText}\n\n${await response.text()}`); } - return await response.json(); + return (await response.json()) as unknown as T; }); } diff --git a/src/connectors/magento1/soap.ts b/src/connectors/magento1/soap.ts index 8135c0f..0f84731 100644 --- a/src/connectors/magento1/soap.ts +++ b/src/connectors/magento1/soap.ts @@ -35,9 +35,10 @@ export class Magento1SoapClient { const { clientPromise, loginResult, requestOptions } = state; const client = await clientPromise; const { sessionId, wsiCompliance } = await loginResult; - const [result] = await useAgent(() => + const response = await useAgent(() => client[`${method}Async`]({ sessionId, ...args }, requestOptions), ); + const result = Array.isArray(response) && response.length > 0 ? response[0] : response; return wsiCompliance ? extractWsiValue(result.result) : extractNonWsiValue(Object.values(result)[0]); diff --git a/src/connectors/magento2/client.ts b/src/connectors/magento2/client.ts index 16c3c2b..d6fb559 100644 --- a/src/connectors/magento2/client.ts +++ b/src/connectors/magento2/client.ts @@ -1,4 +1,4 @@ -import fetch from "node-fetch"; +import type { RequestInfo, RequestInit } from "node-fetch"; import { stringify } from "query-string"; import { EndpointError, MutableReference } from "../../framework"; import * as t from "io-ts"; @@ -8,6 +8,10 @@ import { parse as parseUrl } from "url"; import R from "ramda"; import { boolean } from "fp-ts"; +// dynamically import node-fetch to avoid issues with ESM and CommonJS +const fetch = (...args: [RequestInfo, RequestInit?]) => + import("node-fetch").then(mod => mod.default(...args)); + export type Config = t.TypeOf; export const configSchema = t.intersection([ @@ -149,7 +153,7 @@ export default class Magento2 { throw new EndpointError(`${response.status} ${response.statusText}`, { detail }); } - return await response.json(); + return (await response.json()) as unknown as T; } private async refreshToken(): Promise { diff --git a/src/connectors/shopify/client.ts b/src/connectors/shopify/client.ts index 8e20252..58237af 100644 --- a/src/connectors/shopify/client.ts +++ b/src/connectors/shopify/client.ts @@ -78,7 +78,7 @@ const backoff = const run = async () => { try { return await fn(...args); - } catch (e) { + } catch (e: any) { const actionError = new EndpointError(e.message, { detail: typeof e.response?.body === "object" ? e.response.body.errors ?? e.response.body : null, diff --git a/src/framework/connector.ts b/src/framework/connector.ts index b0f6d7a..15082ca 100644 --- a/src/framework/connector.ts +++ b/src/framework/connector.ts @@ -99,7 +99,7 @@ export function connector - `${commandPrefix}${encodedResourcePath}\n ↳ ${encodedEndpointNames.sort().join(", ")}\n`, + `${commandPrefix}${encodedResourcePath}\n ↳ ${ + Array.isArray(encodedEndpointNames) + ? encodedEndpointNames.sort().join(", ") + : String(encodedEndpointNames) + }\n`, ), ); } diff --git a/src/framework/watch.ts b/src/framework/watch.ts index 41bcb4a..b4d7478 100644 --- a/src/framework/watch.ts +++ b/src/framework/watch.ts @@ -18,7 +18,7 @@ export function watchScope(scope: ConnectorScope): ConnectorScope { } progress.finish(); } catch (e) { - progress.finish(e); + progress.finish(e instanceof Error ? e : new Error(String(e))); throw e; } }, diff --git a/tsconfig.json b/tsconfig.json index 9c3357c..1bd7d99 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,11 +9,18 @@ "typeRoots": [ "node_modules/@types" ], - "lib": ["ES2019"], + "lib": [ + "DOM", + "ES2019", + "ESNext" + ], "esModuleInterop": true, "resolveJsonModule": true, "declaration": true, - "strictNullChecks": true + "strictNullChecks": true, + "skipLibCheck": true, }, - "include": ["src"], -} + "include": [ + "src" + ], +} \ No newline at end of file diff --git a/tsconfig.publish.json b/tsconfig.publish.json index 7fadc3a..919a642 100644 --- a/tsconfig.publish.json +++ b/tsconfig.publish.json @@ -9,11 +9,18 @@ "typeRoots": [ "node_modules/@types" ], - "lib": ["ES2019"], + "lib": [ + "DOM", + "ES2019", + "ESNext" + ], "esModuleInterop": true, "resolveJsonModule": true, "declaration": true, - "strictNullChecks": true + "strictNullChecks": true, + "skipLibCheck": true }, - "include": ["src"], -} + "include": [ + "src" + ], +} \ No newline at end of file