UNPKG

amazon-seller-mcp

Version:

Model Context Protocol (MCP) client for Amazon Selling Partner API

293 lines (292 loc) 5.93 kB
/** * Listings API client for Amazon Selling Partner API */ import { BaseApiClient } from './base-client.js'; import { AuthConfig } from '../types/auth.js'; import { AmazonItemAttributes } from '../types/amazon-api.js'; /** * Parameters for retrieving listings */ export interface GetListingsParams { /** * Seller SKU (optional, if not provided, all listings will be returned) */ sku?: string; /** * List of included data sets */ includedData?: Array<'attributes' | 'issues' | 'offers' | 'fulfillmentAvailability' | 'procurement'>; /** * Page size (1-100) */ pageSize?: number; /** * Page token for pagination */ nextToken?: string; } /** * Parameters for creating or updating a listing */ export interface PutListingParams { /** * Seller SKU */ sku: string; /** * Product type */ productType: string; /** * Product attributes */ attributes: AmazonItemAttributes; /** * Listing requirements */ requirements?: Array<{ /** * Requirement type */ type: string; /** * Requirement value */ value: string; }>; /** * Listing fulfillment availability */ fulfillmentAvailability?: Array<{ /** * Fulfillment channel code */ fulfillmentChannelCode: string; /** * Quantity */ quantity: number; }>; } /** * Parameters for deleting a listing */ export interface DeleteListingParams { /** * Seller SKU */ sku: string; /** * Issue locale */ issueLocale?: string; } /** * Listing identifier */ export interface ListingIdentifier { /** * Marketplace ID */ marketplaceId: string; /** * Amazon Standard Identification Number (ASIN) */ asin?: string; /** * Seller ID */ sellerId: string; } /** * Listing issue */ export interface ListingIssue { /** * Issue code */ code: string; /** * Issue message */ message: string; /** * Issue severity */ severity: 'ERROR' | 'WARNING' | 'INFO'; /** * Attribute names related to the issue */ attributeNames?: string[]; } /** * Listing offer */ export interface ListingOffer { /** * Offer price */ price: { /** * Price amount */ amount: number; /** * Currency code */ currencyCode: string; }; /** * Offer quantity */ quantity: number; } /** * Listing fulfillment availability */ export interface ListingFulfillmentAvailability { /** * Fulfillment channel code */ fulfillmentChannelCode: string; /** * Quantity */ quantity: number; } /** * Listing procurement */ export interface ListingProcurement { /** * Cost price */ costPrice?: { /** * Price amount */ amount: number; /** * Currency code */ currencyCode: string; }; } /** * Listing */ export interface Listing { /** * Seller SKU */ sku: string; /** * Listing status */ status: 'ACTIVE' | 'INACTIVE' | 'INCOMPLETE' | 'REMOVED'; /** * Listing identifiers */ identifiers: ListingIdentifier; /** * Listing attributes */ attributes?: AmazonItemAttributes; /** * Listing issues */ issues?: ListingIssue[]; /** * Listing offers */ offers?: ListingOffer[]; /** * Listing fulfillment availability */ fulfillmentAvailability?: ListingFulfillmentAvailability[]; /** * Listing procurement */ procurement?: ListingProcurement; } /** * Listings result */ export interface ListingsResult { /** * Listings */ listings: Listing[]; /** * Next token for pagination */ nextToken?: string; } /** * Listing submission result */ export interface ListingSubmissionResult { /** * Submission ID */ submissionId: string; /** * Submission status */ status: 'ACCEPTED' | 'REJECTED'; /** * Submission issues */ issues?: ListingIssue[]; } /** * Listings API client for Amazon Selling Partner API */ export declare class ListingsClient extends BaseApiClient { /** * API version */ private readonly apiVersion; /** * Create a new ListingsClient instance * * @param authConfig Authentication configuration */ constructor(authConfig: AuthConfig); /** * Get listings * * @param params Parameters for retrieving listings * @returns Promise resolving to the listings result */ getListings(params?: GetListingsParams): Promise<ListingsResult>; /** * Get a single listing by SKU * * @param sku Seller SKU * @param includedData List of included data sets * @returns Promise resolving to the listing */ getListing(sku: string, includedData?: Array<'attributes' | 'issues' | 'offers' | 'fulfillmentAvailability' | 'procurement'>): Promise<Listing>; /** * Create or update a listing * * @param params Parameters for creating or updating a listing * @returns Promise resolving to the submission result */ putListing(params: PutListingParams): Promise<ListingSubmissionResult>; /** * Delete a listing * * @param params Parameters for deleting a listing * @returns Promise resolving to the submission result */ deleteListing(params: DeleteListingParams): Promise<ListingSubmissionResult>; /** * Validate listing data * * @param params Listing parameters to validate * @throws Error if validation fails */ private validateListingData; }