Hierarchy

  • default
    • Promotions

Constructors

  • Parameters

    • __namedParameters: EndpointOptions

    Returns Promotions

Methods

  • Returns a list of all Promotions. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.promotions.list({
    bearer_token: '7381273269536713689562374856'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & Record<string, any>>

    Returns Promise<IPromotionsResult>

  • Returns a single Promotion by its ID. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.promotions.show({
    bearer_token: '7381273269536713689562374856'
    id: '1'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & {
          id: string;
      }>

    Returns Promise<IPromotionResult>

  • Creates a new Promotion and returns its attributes. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.promotions.create({
    bearer_token: '7381273269536713689562374856',
    promotion: {
    name: 'Promotions Used in 2021',
    code: 'BLK-FRI',
    description: 'Save today with discount code XYZ at checkout.',
    usage_limit: 100,
    advertise: true,
    starts_at: 'string',
    ends_at: 'string',
    store_ids: ['2']
    }
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & PromotionParams>

    Returns Promise<IPromotionResult>

  • Update the selected Promotion. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.pages.update({
    bearer_token: '7381273269536713689562374856',
    id: '1',
    promotion: {
    name: 'Promotions Used in 2021',
    code: 'CYB-MON',
    description: 'Save today with discount code XYZ at checkout.',
    usage_limit: 100,
    advertise: true,
    starts_at: 'string',
    ends_at: 'string',
    store_ids: ['2']
    }
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & PromotionParams & {
          id: string;
      }>

    Returns Promise<IPromotionResult>

  • This endpoint removes the specified Promotion. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.promotions.remove({
    bearer_token: '7381273269536713689562374856',
    id: '1'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & Record<string, unknown> & {
          id: string;
      }>

    Returns Promise<NoContentResult>

  • Type Parameters

    • ResponseType = JsonApiResponse

    Parameters

    • method: HttpMethod
    • url: string
    • Optional tokens: IToken
    • Optional params: any
    • Optional responseParsing: ResponseParsing

    Returns Promise<ResultResponse<ResponseType>>

  • The HTTP error code returned by Spree is not indicative of its response shape. This function determines the information provided by Spree and uses everything available.

    Parameters

    • error: default

    Returns ErrorType

  • Parameters

    • error: Error

    Returns default

  • Parameters

    • error: default

    Returns default

  • Parameters

    • tokens: IToken

    Returns {
        [headerName: string]: string;
    }

    • [headerName: string]: string

Properties

fetcher: Fetcher

Generated using TypeDoc