Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Promotions

Launch and manage promotions across your storefront.

For instructions on how to retrieve access token for admin APIs: https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-admin-apis.html

Example with admin auth

import { Pricing, ClientConfig } from "commerce-sdk";
// or
const { Pricing, ClientConfig } = require("commerce-sdk");

const clientConfig: ClientConfig = {
  parameters: {
    clientId: "XXXXXX",
    organizationId: "XXXX",
    shortCode: "XXX",
    siteId: "XX"
  }
};

token = { access_token: 'INSERT_ACCESS_TOKEN_HERE' };

clientConfig.headers['authorization'] = `Bearer ${token.access_token}`;
const promotionsClient = new Pricing.Promotions(clientConfig);
API Version: 1.0.24
Last Updated:

Hierarchy

  • BaseClient
    • Promotions

Index

Type aliases

Static AsyncCreated

AsyncCreated: {}

Type declaration

Static AttributeDefinition

AttributeDefinition: { defaultValue?: PropertyValueDefinition; description: L10nString; id?: string; key?: boolean; localizable?: boolean; mandatory?: boolean; max?: number; min?: number; minLength?: number; multiValueType?: boolean; name: L10nString; possibleValues?: Array<PropertyValueDefinition>; regularExpression?: string; scale?: number; searchable?: boolean; siteSpecific?: boolean; system?: boolean; type: string; unit?: L10nString; visible?: boolean }

Type declaration

  • Optional defaultValue?: PropertyValueDefinition
  • description: L10nString
  • Optional id?: string
  • Optional key?: boolean
  • Optional localizable?: boolean
  • Optional mandatory?: boolean
  • Optional max?: number
  • Optional min?: number
  • Optional minLength?: number
  • Optional multiValueType?: boolean
  • name: L10nString
  • Optional possibleValues?: Array<PropertyValueDefinition>
  • Optional regularExpression?: string
  • Optional scale?: number
  • Optional searchable?: boolean
  • Optional siteSpecific?: boolean
  • Optional system?: boolean
  • type: string
  • Optional unit?: L10nString
  • Optional visible?: boolean

Static BoolFilter

BoolFilter: { filters?: Array<Filter>; operator: string } & {}

Static BoolQuery

BoolQuery: { must?: Array<Query>; mustNot?: Array<Query>; should?: Array<Query> } & {}

Static Campaign

Campaign: { campaignId: string; coupons?: Array<string>; creationDate?: any; customerGroups?: Array<string>; description?: string; enabled?: boolean; endDate?: any; lastModified?: any; sourceCodeGroups?: Array<string>; startDate?: any } & {}

Static ChangeControlled

ChangeControlled: { createdBy?: string; creationDate?: any; lastModifiedBy?: string; modificationDate?: any } & {}

Static ChangeControlledDataType

ChangeControlledDataType: { createdBy?: string; creationDate?: any; lastModifiedBy?: string; modificationDate?: any } & {}

Static ClosedObject

ClosedObject: {} & {}

Static DateConditionalRequest

DateConditionalRequest: {}

Type declaration

Static DateRangeFilter

DateRangeFilter: {}

Type declaration

Static DatetimeRangeFilter

DatetimeRangeFilter: {}

Type declaration

Static Error

Error: { detail?: string; instance?: string; title?: string; type: string } & {}

Static ErrorResponse

ErrorResponse: { detail?: string; instance?: string; title?: string; type: string } & {}

Static EtagConditionalRequest

EtagConditionalRequest: {}

Type declaration

Static EtagResponse

EtagResponse: {}

Type declaration

Static Filter

Filter: { boolFilter?: BoolFilter; queryFilter?: QueryFilter; range2Filter?: Range2Filter; rangeFilter?: RangeFilter; termFilter?: TermFilter } & {}

Static FilteredQuery

FilteredQuery: { filter: Filter; query: Query } & {}

Static IntegerRangeFilter

IntegerRangeFilter: {}

Type declaration

Static L10nString

L10nString: {} & {}

Static LocalizedString

LocalizedString: {} & {}

Static MatchAllQuery

MatchAllQuery: {} & {}

Static Money

Money: { currencyMnemonic?: string; value?: number } & {}

Static MoneyMnemonic

MoneyMnemonic: { currencyMnemonic?: string; value?: number } & {}

Static NestedQuery

NestedQuery: { path: string; query: Query; scoreMode?: string } & {}

Static NoPropertiesAllowed

NoPropertiesAllowed: {}

Type declaration

Static NumericRangeFilter

NumericRangeFilter: {}

Type declaration

Static OffsetPaginated

OffsetPaginated: {}

Type declaration

Static OpenObject

OpenObject: {} & {}

Static PaginatedSearchResult

PaginatedSearchResult: { hits?: Array<object>; limit: number; offset: any; query: Query; sorts?: Array<Sort>; total: any } & {}

Static PaginatedSearchResultBase

PaginatedSearchResultBase: { hits?: Array<object>; limit: number; offset: any; query: Query; sorts?: Array<Sort>; total: any } & {}

Static Promotion

Promotion: { archived?: boolean; assignmentInformation?: PromotionAssignmentInformation; creationDate?: any; currencyCode?: string; disableGloballyExcluded?: boolean; enabled?: boolean; exclusivity?: string; id?: string; lastModified?: any; name?: {} & {}; promotionClass?: string; siteId?: string; tags?: Array<Tag> } & {}

Static PromotionAbtestGroupAssignment

PromotionAbtestGroupAssignment: { abtestDescription: string; abtestId: string; enabled: boolean; schedule: Schedule; segmentDescription: string; segmentId: string }

Type declaration

  • abtestDescription: string
  • abtestId: string
  • enabled: boolean
  • schedule: Schedule
  • segmentDescription: string
  • segmentId: string

Static PromotionAssignmentInformation

PromotionAssignmentInformation: { abtestId?: string; abtestSegmentId?: string; active: boolean; activeAbtestAssignments?: Array<PromotionAbtestGroupAssignment>; activeCampaignAssignments: Array<PromotionCampaignAssignment>; campaignId: string; enabled: boolean; endDate?: any; schedule: Schedule; scheduleType: string; startDate?: any; upcomingAbtestAssignments?: Array<PromotionAbtestGroupAssignment>; upcomingCampaignAssignments?: Array<PromotionCampaignAssignment> }

Type declaration

Static PromotionCampaignAssignment

PromotionCampaignAssignment: { campaign?: Campaign; campaignId: string; coupons?: Array<string>; customerGroups?: Array<string>; description: string; enabled: boolean; promotion?: Promotion; promotionId: string; rank?: number; schedule: Schedule; sourceCodeGroups?: Array<string> }

Type declaration

  • Optional campaign?: Campaign
  • campaignId: string
  • Optional coupons?: Array<string>
  • Optional customerGroups?: Array<string>
  • description: string
  • enabled: boolean
  • Optional promotion?: Promotion
  • promotionId: string
  • Optional rank?: number
  • schedule: Schedule
  • Optional sourceCodeGroups?: Array<string>

Static PromotionIdConflict

PromotionIdConflict: {}

Type declaration

Static PromotionNotFound

PromotionNotFound: {}

Type declaration

Static PromotionSearchResult

PromotionSearchResult: { hits: Array<Promotion>; limit: number; offset: any; query: Query; sorts?: Array<Sort>; total: any } & {}

Static PropertyDefinition

PropertyDefinition: { defaultValue?: PropertyValueDefinition; description: L10nString; id?: string; key?: boolean; localizable?: boolean; mandatory?: boolean; max?: number; min?: number; minLength?: number; multiValueType?: boolean; name: L10nString; possibleValues?: Array<PropertyValueDefinition>; regularExpression?: string; scale?: number; searchable?: boolean; siteSpecific?: boolean; system?: boolean; type: string; unit?: L10nString; visible?: boolean } & {}

Static PropertyValueDefinition

PropertyValueDefinition: { description: L10nString; displayValue: L10nString; id: string; position?: number; value: string }

Type declaration

  • description: L10nString
  • displayValue: L10nString
  • id: string
  • Optional position?: number
  • value: string

Static Query

Query: { boolQuery?: BoolQuery; filteredQuery?: FilteredQuery; matchAllQuery?: MatchAllQuery; nestedQuery?: NestedQuery; termQuery?: TermQuery; textQuery?: TextQuery } & {}

Static QueryFilter

QueryFilter: { query: Query } & {}

Static QueryParamsLimit

QueryParamsLimit: {}

Type declaration

Static QueryParamsOffset

QueryParamsOffset: {}

Type declaration

Static Range2Filter

Range2Filter: { filterMode?: string; fromField: string; fromInclusive?: boolean; fromValue?: any; toField: string; toInclusive?: boolean; toValue?: any } & {}

Static RangeFilter

RangeFilter: {}

Type declaration

Static RateLimited

RateLimited: {}

Type declaration

Static RateLimited2

RateLimited2: {}

Type declaration

Static RateLimited3

RateLimited3: {}

Type declaration

Static RateLimited4

RateLimited4: {}

Type declaration

Static RateLimited5

RateLimited5: {}

Type declaration

Static Recurrence

Recurrence: { dayOfWeek: Array<string>; timeOfDay: TimeOfDay }

Type declaration

  • dayOfWeek: Array<string>
  • timeOfDay: TimeOfDay

Static Schedule

Schedule: { endDate?: any; recurrence?: Recurrence; startDate?: any }

Type declaration

  • Optional endDate?: any
  • Optional recurrence?: Recurrence
  • Optional startDate?: any

Static SearchRequest

SearchRequest: { limit?: number; offset?: any; query: Query; sorts?: Array<Sort> } & {}

Static SearchRequestBase

SearchRequestBase: { limit?: number; offset?: any; query: Query; sorts?: Array<Sort> } & {}

Static Selectable

Selectable: {}

Type declaration

Static SimpleSearchResult

SimpleSearchResult: { hits?: Array<object>; limit: number; offset: any; total: any } & {}

Static SimpleSearchResultBase

SimpleSearchResultBase: { hits?: Array<object>; limit: number; offset: any; total: any } & {}

Static SiteSpecific

SiteSpecific: {}

Type declaration

Static Sort

Sort: { field: string; sortOrder?: string } & {}

Static SpecifiedPropertiesAllowed

SpecifiedPropertiesAllowed: {} & {}

Static SyncCreated

SyncCreated: {}

Type declaration

Static Tag

Tag: { tagId: string }

Type declaration

  • tagId: string

Static TermFilter

TermFilter: { field: string; operator: string; values?: Array<any> } & {}

Static TermQuery

TermQuery: { fields: Array<string>; operator: string; values?: Array<any> } & {}

Static TextQuery

TextQuery: { fields: Array<string>; searchPhrase: string } & {}

Static TimeOfDay

TimeOfDay: { timeFrom: string; timeTo: string }

Type declaration

  • timeFrom: string
  • timeTo: string

Constructors

constructor

  • new Promotions(config: ClientConfig): Promotions
  • Parameters

    • config: ClientConfig

    Returns Promotions

Properties

clientConfig

clientConfig: ClientConfig

Methods

createPromotion

  • createPromotion(options: { body: Promotion; fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }): Promise<Promotion>
  • createPromotion<T>(options: { body: Promotion; fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : Promotions.Promotion>
  • Creates a promotion using the information provided.

    If you would like to get a raw Response object use the other createPromotion function.

    Parameters

    • options: { body: Promotion; fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • body: Promotion
      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { id: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<Promotion>

    A promise of type Promotions.Promotion.

  • Creates a promotion using the information provided.

    Type parameters

    • T: boolean

    Parameters

    • options: { body: Promotion; fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • body: Promotion
      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { id: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Promotions.Promotion>

    A promise of type Response if rawResponse is true, a promise of type Promotions.Promotion otherwise.

deletePromotion

  • deletePromotion(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }): Promise<void>
  • deletePromotion<T>(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : void>
  • Deletes the promotion by ID.

    If you would like to get a raw Response object use the other deletePromotion function.

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { id: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<void>

    A promise of type void.

  • Deletes the promotion by ID.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { id: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

getPromotion

  • getPromotion(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }): Promise<Promotion>
  • getPromotion<T>(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : Promotions.Promotion>
  • Action to get promotion information.

    If you would like to get a raw Response object use the other getPromotion function.

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { id: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<Promotion>

    A promise of type Promotions.Promotion.

  • Action to get promotion information.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { id: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Promotions.Promotion>

    A promise of type Response if rawResponse is true, a promise of type Promotions.Promotion otherwise.

promotionsSearch

  • promotionsSearch(options: { body: SearchRequest; fetchOptions?: RequestInit; headers?: {}; parameters?: { organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }): Promise<PromotionSearchResult>
  • promotionsSearch<T>(options: { body: SearchRequest; fetchOptions?: RequestInit; headers?: {}; parameters?: { organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : Promotions.PromotionSearchResult>
  • Searches for promotions.

    The SearchRequest document contains a search object that allows filtering on various attributes.

    The query attribute specifies a complex query that can be used to narrow down the search using the following searchable attributes:

    Attribute Type
    id String
    name String
    currecyCode String
    exclusivity String
    enabled Boolean

    Note that only searchable attributes can be used in sorting. Additionally, the following attribute can be used to sort:

    Attribute Type
    promotionClass String

    If you would like to get a raw Response object use the other promotionsSearch function.

    Parameters

    • options: { body: SearchRequest; fetchOptions?: RequestInit; headers?: {}; parameters?: { organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • body: SearchRequest
      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<PromotionSearchResult>

    A promise of type Promotions.PromotionSearchResult.

  • Searches for promotions.

    The SearchRequest document contains a search object that allows filtering on various attributes.

    The query attribute specifies a complex query that can be used to narrow down the search using the following searchable attributes:

    Attribute Type
    id String
    name String
    currecyCode String
    exclusivity String
    enabled Boolean

    Note that only searchable attributes can be used in sorting. Additionally, the following attribute can be used to sort:

    Attribute Type
    promotionClass String

    Type parameters

    • T: boolean

    Parameters

    • options: { body: SearchRequest; fetchOptions?: RequestInit; headers?: {}; parameters?: { organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • body: SearchRequest
      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Promotions.PromotionSearchResult>

    A promise of type Response if rawResponse is true, a promise of type Promotions.PromotionSearchResult otherwise.

updatePromotion

  • updatePromotion(options: { body: Promotion; fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }): Promise<Promotion>
  • updatePromotion<T>(options: { body: Promotion; fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : Promotions.Promotion>
  • Updates the promotion with the specified information.

    If you would like to get a raw Response object use the other updatePromotion function.

    Parameters

    • options: { body: Promotion; fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • body: Promotion
      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { id: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<Promotion>

    A promise of type Promotions.Promotion.

  • Updates the promotion with the specified information.

    Type parameters

    • T: boolean

    Parameters

    • options: { body: Promotion; fetchOptions?: RequestInit; headers?: {}; parameters?: { id: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • body: Promotion
      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { id: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Promotions.Promotion>

    A promise of type Response if rawResponse is true, a promise of type Promotions.Promotion otherwise.

Generated using TypeDoc