# anton-pws

> Example NodeJS SDK for Autodesk PWS

Latest version **1.0.6** (published 2023-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install anton-pws
pnpm add anton-pws
yarn add anton-pws
bun add anton-pws
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2023-04-05 |
| First published | 2022-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 39.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Anton Horvath |
| Maintainers | antonhi |

## Links

- npm: https://www.npmjs.com/package/anton-pws
- npm.io page: https://npm.io/package/anton-pws

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^1.2.1
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.1.1
- [@types/node](https://npm.io/package/@types/node.md) ^18.11.17
- [@types/crypto-js](https://npm.io/package/@types/crypto-js.md) ^4.1.1

## Recent versions

- 1.0.6 (latest) — 2023-04-05
- 1.0.5 — 2023-04-05
- 1.0.4 — 2023-04-05
- 1.0.3 — 2023-01-06
- 1.0.2 — 2023-01-06
- 1.0.1 — 2022-12-27
- 1.0.0 — 2022-12-27
- 0.2.3 — 2022-12-27
- 0.2.2 — 2022-12-27
- 0.2.1 — 2022-12-27
- 0.2.0 — 2022-12-26
- 0.1.9 — 2022-12-26
- 0.1.8 — 2022-12-26
- 0.1.7 — 2022-12-26
- 0.1.6 — 2022-12-26
- … 16 more at https://npm.io/package/anton-pws/versions

## README

# anton-pws
Example NodeJS SDK for Autodesk PWS.

## Initializing the Client
1. Obtain your credentials from the [Partner Developer Portal](https://partner.developer.autodesk.com). This includes your:
    - consumerSecret (obtained within an app you create in the Portal)
    - consumerKey (obtained within an app you create in the Portal)
    - csn (obtained from the Portal when logged in)
2. You must initialize a PWS client to use all SDK functionality. This can be done by calling the `PWS` function and passing in your credentials.

```js
const client = PWS(consumerKey, consumerSecret, csn);
```

## Placing an Initial Order
You can use the `fulfillment` module to place an initial order:

```js
const order = await client.orders.v1.fulfillment.placeInitialOrder(InitialOrder, callbackUrl, environmentUrl);
```

API reference documentation can be found [here](https://partner.developer.autodesk.com/contents/files/api-reference-manuals/en/pws-placeorder-v2-service-reference-manual.pdf?ts=1669225760000).

## Getting an Order Status
You can use the `status` module to retrieve an order status:

```js
const status = await client.orders.v1.status.get(transactionId, callbackUrl, environmentUrl);
```

API reference documentation can be found [here](https://partner.developer.autodesk.com/contents/files/api-reference-manuals/en/pws-get-order-status-service-reference-manual.pdf?ts=1669227350000).

## Models

An `InitialOrder` has the following JSON structure ('?' denotes optional property):

```json
{
    "endCustomerAccount": "{Account}",
    "endCustomerContractManager": "{Contact}",
    "shipTo": "{Account}",
    "reseller": "string",
    "soldTo": "string",
    "governmentEntity": "string?",
    "poNumber": "string",
    "customerPoNumber": "string?",
    "contractStartDate": "string?",
    "priceDate": "string?",
    "items": "[InitialProduct]",
    "discounts": "[Discount]"
}
```

An `Account` has the following JSON structure ('?' denotes optional property):

```json
{
    "csn": "string?",
    "name": "string?",
    "altName": "string?",
    "addressLine1": "string?",
    "addressLine2": "string?",
    "addressLine3": "string?",
    "city": "string?",
    "postalCode": "string?",
    "stateProvinceCode": "string?",
    "countryCode": "string?",
    "phoneNumber": "string?"
}
```

A `Contact` has the following JSON structure ('?' denotes optional property):

```json
{
    "firstName": "string",
    "lastName": "string",
    "email": "string",
    "countryCode": "string?",
    "language": "string?"
}
```

An `InitialProduct` has the following JSON structure ('?' denotes optional property):

```json
{
    "partNumber": "string",
    "partnerSubscriptionId": "string?",
    "quantity": 2
}
```

A `Discount` has the following JSON structure ('?' denotes optional property):

```json
{
    "discountId": "string",
    "discountType": "{DiscountType}"
}
```

The `DiscountType` enum has the following possible values: DDA

---
_Source: https://npm.io/package/anton-pws · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
