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

xl-automaten-api

v0.0.4

Published

Unofficial TypeScript client library for the XL Automaten API

Downloads

111

Readme

= xl-automaten-api

An unofficial TypeScript client library for the https://xl-automaten.de/[XL Automaten] API.

You can use this library to access the API in an easy and type-safe way.

== Install

Just install it with your favorite package manager:

yarn add xl-automaten-api
pnpm add xl-automaten-api
npm install xl-automaten-api

The package should work in the browser and Node.js versions 18 and up.

== Examples

== Obtain an auth token

You need an API token for nearly all operations. You can get one by calling the login function:

const { token } = await login({
  email,
  password,
})
console.log("Your token is", token)

The token is typically valid for 1 hour.

=== Create a pickup

You can create a new pickup code that can be used to pick up an order:

const pickup = await createPickup({
  pickup: {
    code: "code-that-will-be-used-to-pickup-the-order",
    valid_from: new Date(),
    valid_until: new Date(Date.now() + 1000 * 60 * 60 * 24),
    mastermoduleId: 99,
  },
  token: "your-token",
})

console.log(pickup)

=== Get information about an existing pickup

To get information about an existing pickup, use the getPickup function:

const pickup = await getPickup({
  code: "code-of-an-existing-pickup",
  token: "your-token",
})

console.log(pickup)

// With getPickup, you can also get the items included in the pickup:
console.log(pickup.items)

=== Delete an existing pickup

To delete an existing pickup, use the deletePickup function:

const pickup = await createPickup({
  pickup: {
    code: "any-string-you-want",
    valid_from: new Date(),
    valid_until: new Date(Date.now() + 1000 * 60 * 60 * 24),
    mastermoduleId: 99,
  },
  token: "your-token",
})

console.log(pickup)

=== Other operations

You can also create articles (createArticle) and add them to a pickup with createPickupItem. This library also includes functions for accessing machines (e.g., createMachine), mastermodules (getMastermodules), trays, positions, categories, and suppliers. The source code includes comments with examples for these endpoints.

== API Documentation

There is no public API documentation for the XL Automaten API. This package is based on reverse engineering the API and emailing the people from XL Automaten.

I am still figuring out how everything works, so the API is not yet stable. I will update the README once I have enough confidence in the correctness of this package.

Most endpoints are documented in TypeScript in the src/helpers/convert*.ts files.

== Known API endpoints

[cols="1,1"] |=== |endpoint |supported by this package |supported methods

|Cell in column 1, row 2 |Cell in column 2, row 2

|Cell in column 1, row 3 |Cell in column 2, row 3 |===

== Older node versions

This package uses the fetch API, which is only supported in Node.js 18 and up. If you need to use an older version of Node.js, you can use node-fetch. It will be detected and used automatically if your node does not provide a native fetch. The Options object supports passing a custom fetch function. You can also try to pass node-fetch there.

== Building and testing this package

To run the tests for this package, you need to have credentials for XL Automaten. Put these credentials into the src/tests/login.ts file. Now you can run yarn test to run the tests.