Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prestashop/ws-client
A webservice client library for PrestaShop written in TypeScript
https://github.com/prestashop/ws-client
hacktoberfest library prestashop testing webservices
Last synced: about 1 month ago
JSON representation
A webservice client library for PrestaShop written in TypeScript
- Host: GitHub
- URL: https://github.com/prestashop/ws-client
- Owner: PrestaShop
- License: mit
- Created: 2023-10-04T13:50:30.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-06T17:22:14.000Z (6 months ago)
- Last Synced: 2024-05-07T09:15:12.218Z (6 months ago)
- Topics: hacktoberfest, library, prestashop, testing, webservices
- Language: TypeScript
- Homepage:
- Size: 219 KB
- Stars: 4
- Watchers: 8
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WS-CLIENT
## Description
Typescript [Webservice](https://devdocs.prestashop-project.org/8/webservice/) Client to use with PrestaShop Core.
TO DO :
- Typing : 2 types are required
- Readable
- WritablePrestaShop Compatibility :
- 9
- 8
- 1.7NodeJs compatibility :
- 18
## Endpoint to implement
| Endpoint | URL | Done |
|------------| --- | ---- |
| addresses | | [] |
| carts | | [] |
| cart_rules | | [] |
| categories | | [] |
| country | | [] |
| customers | | [] |
| orders | | [] |
| products | | [] |
| stores | | [] |
| taxes | | [] |
| tax_rules | | [] |## Stack
- [fetch](https://www.npmjs.com/package/node-fetch)
- Typescript## How to use
Set up the env file:
```sh
cp .env.dist .env
open .env
```Run some code:
```js
const client = new BaseClient({
baseURl: process.env.BASE_URL, // URL of your PrestaShop
wsKey: process.env.WS_KEY, // Key to connect to your prestashop
});const response = await client.product.create(productData);
console.log(response.status);
console.log(response.data.product); // Maybe return type writable ??// Error case
// Return an Exeption depending on what is the error.
// UnreachableServerException
// WrongPayloadException
// RequestTimeoutException
// InvalidCredentialsException
```# Build
Install dependencies:
```sh
npm install -g pnpm
pnpm install
```Build the library:
```sh
pnpm build
```Test the library:
```sh
pnpm test
```# Contributing
This library is an open source solution. Everyone is welcome and even encouraged to contribute with their own improvements!
Just make sure to follow our [contribution guidelines](https://devdocs.prestashop-project.org/8/contribute/contribution-guidelines/project-modules/).
## Reporting issues
You can report issues [here](https://github.com/PrestaShop/ws-client/issues/new).