ordercloud-javascript-sdk
    Preparing search index...

    Class Promotions

    Index
    • Returns this

      enables impersonation by calling the subsequent method with the stored impersonation token

      Promotions.As().List() // lists Promotions using the impersonated users' token
      
    • Delete a promotion Check out the docs for more info

      Parameters

      • promotionID: string

        ID of the promotion.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<void>

    • Delete a promotion assignment Check out the docs for more info

      Parameters

      • promotionID: string

        ID of the promotion.

      • listOptions: { buyerID?: string; userGroupID?: string; userID?: string } = {}
        • OptionalbuyerID?: string

          ID of the buyer.

        • OptionaluserGroupID?: string

          ID of the user group.

        • OptionaluserID?: string

          ID of the user.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<void>

    • List promotions Check out the docs for more info

      Type Parameters

      Parameters

      • listOptions: {
            filters?: Filters;
            page?: number;
            pageSize?: number;
            search?: string;
            searchOn?: (
                | "ID"
                | "Name"
                | "Description"
                | "Code"
                | "FinePrint"
                | "EligibleExpression"
                | "ValueExpression"
            )[];
            sortBy?: (
                | "ID"
                | "Name"
                | "ExpirationDate"
                | "Code"
                | "EligibleExpression"
                | "ValueExpression"
                | "!ID"
                | "!Name"
                | "!ExpirationDate"
                | "StartDate"
                | "CanCombine"
                | "AutoApply"
                | "Active"
                | "Priority"
                | "!Code"
                | "!StartDate"
                | "!EligibleExpression"
                | "!ValueExpression"
                | "!CanCombine"
                | "!AutoApply"
                | "!Active"
                | "!Priority"
            )[];
        } = {}
        • Optionalfilters?: Filters

          An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???'

        • Optionalpage?: number

          Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.

        • OptionalpageSize?: number

          Number of results to return per page.

        • Optionalsearch?: string

          Word or phrase to search for.

        • OptionalsearchOn?: (
              | "ID"
              | "Name"
              | "Description"
              | "Code"
              | "FinePrint"
              | "EligibleExpression"
              | "ValueExpression"
          )[]

          Comma-delimited list of fields to search on.

        • OptionalsortBy?: (
              | "ID"
              | "Name"
              | "ExpirationDate"
              | "Code"
              | "EligibleExpression"
              | "ValueExpression"
              | "!ID"
              | "!Name"
              | "!ExpirationDate"
              | "StartDate"
              | "CanCombine"
              | "AutoApply"
              | "Active"
              | "Priority"
              | "!Code"
              | "!StartDate"
              | "!EligibleExpression"
              | "!ValueExpression"
              | "!CanCombine"
              | "!AutoApply"
              | "!Active"
              | "!Priority"
          )[]

          Comma-delimited list of fields to sort by.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<RequiredObjectDeep<ListPage<TPromotion>>>

    • List promotion assignments Check out the docs for more info

      Type Parameters

      Parameters

      • listOptions: {
            buyerID?: string;
            level?: "Group" | "Company";
            page?: number;
            pageSize?: number;
            promotionID?: string;
            userGroupID?: string;
        } = {}
        • OptionalbuyerID?: string

          ID of the buyer.

        • Optionallevel?: "Group" | "Company"

          Level of the promotion assignment. Possible values: Group, Company, BuyerGroup.

        • Optionalpage?: number

          Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.

        • OptionalpageSize?: number

          Number of results to return per page.

        • OptionalpromotionID?: string

          ID of the promotion.

        • OptionaluserGroupID?: string

          ID of the user group.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<RequiredObjectDeep<ListPage<TPromotionAssignment>>>

    • List promotion codes List generated codes for a promotion. Only applicable when GeneratedCodeCount > 0. Check out the docs for more info

      Type Parameters

      Parameters

      • promotionID: string

        ID of the promotion.

      • listOptions: { page?: number; pageSize?: number } = {}
        • Optionalpage?: number

          Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.

        • OptionalpageSize?: number

          Number of results to return per page.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<RequiredObjectDeep<ListPage<TPromotionCode>>>

    • Create or update a promotion If an object with the same ID already exists, it will be overwritten. Check out the docs for more info

      Type Parameters

      Parameters

      • promotionID: string

        ID of the promotion.

      • promotion: Promotion

        Required fields: EligibleExpression

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<RequiredDeep<TPromotion>>

    • Create or update a promotion assignment Check out the docs for more info

      Parameters

      • promotionAssignment: PromotionAssignment

        Required fields: PromotionID, BuyerID

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<void>