npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dotdev/apparel21-sdk

v0.0.80

Published

Apparel21 Interface Library

Downloads

415

Readme

Apparel21 SDK

This SDK wraps AP21 API and returns the response formatted as regular JavaScript objects.

Wrapped endpoints

The following endpoints are wrapped by this SDK:

Core endpoints (All required)

  • [x] GET /ReferenceTypes
  • [x] GET /ReferenceTypes/{id}
  • [x] GET /Products
  • [x] GET /Products/{id}
  • [x] GET /ProductsSimple
  • [x] GET /ProductsSimpleWithPagination
  • [x] GET /ProductsSimple/{id}
  • [x] GET /ProductNotes/{id}
  • [x] GET /ProductColourNotes/{id}
  • [x] GET /Colours
  • [x] GET /Sizes
  • [x] GET /Persons
  • [x] GET /Persons/{id}
  • [x] POST /Persons
  • [x] PUT /Persons/{id}
  • [x] GET /Persons/{id}/Orders
  • [x] GET /Persons/{id/Orders/{id}
  • [x] GET /Persons/{id}/Shipments/{orderId}
  • [x] POST /Persons/{id}/Orders
  • [x] GET /Persons/{id}/RetailTransactions
  • [x] POST /Persons/{id}/Orders/{id}/Returns
  • [x] GET /Persons/{id}/Orders/{id}/Returns/{id}
  • [x] GET /Vouchers/{number}/?pin={pin}
  • [x] GET /Voucher/GVValid/{number}?pin={pin}&amount={amount}
  • [x] GET /Voucher/Lock/{number}?ValidationId={id}&LockSeconds={seconds}
  • [x] GET /Freestock/style/{id}
  • [x] GET /Freestock/clr/{id}
  • [x] GET /Freestock/sku/{id}
  • [x] GET /StockChanged?ChangedSince={date}
  • [x] GET /Stores
  • [x] GET /Stores/{id}
  • [x] GET /Orders?UpdatedAfter={date}

Loyalty (Low priority)

We have implemented these for Tony Bianco loyalty. However, they're the only ones currently using this module. We will need to support it at some point but not a top priority for now.

  • [x] GET /Rewards/Programs
  • [x] GET /Rewards/Accounts/{id}
  • [x] POST /Rewards/Accounts

Loyalty (Extra-low priority)

These ones will be great to support but not currently needed (we don't "change" the loyalty account in any way right now, it's all done internally at AP21).

  • [x] PUT /Rewards/Accounts
  • [x] GET /Rewards/Accounts/{id}/Transactions
  • [x] POST /Rewards/Accounts/{id}/Rewards
  • [x] POST /Rewards/Accounts/{id}/Gifts
  • [x] POST /Rewards/Accounts/{id}/Points
  • [x] POST /Rewards/Accounts/{id}/Rewards/Redemptions
  • [x] POST /Rewards/Accounts/{id}/Gifts/Redemptions
  • [x] POST /Rewards/Accounts/{id}/Points/Redemptions
  • [x] POST /Rewards/Confirmation?requestId={id}
  • [x] POST /Rewards/Reversal?requestId={id}

For more details on these endpoints see the wiki page

Tests

The SDK has automatic tests for each exposed method of the AP21 instance and its modules. There is an integration test file, however, coverage is not full. Most integration tests are commented out since details of the tests are tied to particual AP21 instances (such as person, product etc ids). To run the integration tests you first need to add a secret config (use credentials from 1password), see the example config file.

Each endpoint is mocked in the ./src/__mocks__/axios.ts file. There are mock XML payloads in the ExamplePayloads folder. These are based on a combination of real payloads and AP21 documentation examples

Next steps

This SDK has primarily been developed against the AP21 documentation.

  • Most safe endpoints (GET) have also been verified against a few live instances of AP21.
  • Most non-safe endpoints (POST, PUT) have been tested against the AP21 test instance DotDev has access to (check 1password for credentials).

However, a lot of endpoints listed above are lacking proper setup in the AP21 test instance meaning they have not been verified to work against a live environment (see list below).

The AP21 documentation example payloads are full of errors and are often invalid XML. Meaning some of the covered endpoints may need updates once tested against a live environment and real payloads.

The first step should be to battle test the SDK against various live environments to ensure it reads and remaps the required data from XML to JS.

To test and verify the non-safe endpoints the AP21 test instance should be configured for gift vouchers and rewards.

Unverified

The following have not been possible to verify against a live environment:

| Entity | Reason | | --------- | ------------------------------------------------------------------------- | | Rewards | No rewards set up in test instance | | Vouchers | No vouchers set up in test instace | | Returns | Not able to create a return. Could be due to order status? | | Shipments | Need to run against real instance or have status updated in test instance |