From 8dd28b8be983bf43e52f51fadbea3b9894f39c6c Mon Sep 17 00:00:00 2001 From: Jens Verbeken Date: Tue, 10 Aug 2021 08:37:33 +0200 Subject: [PATCH] fixes --- CHANGELOG.md | 7 +++++++ README.md | 2 +- package.json | 2 +- src/http-client.ts | 5 ++++- src/index.ts | 4 ++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e7300b..7fdbcf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.4] - 2021-08-10 + +### Changed + +- fixed inconsistency in README with parameter naming +- remove trailing slash on url parameter on client creation + ## [1.0.3] - 2021-03-18 ### Changed diff --git a/README.md b/README.md index a95b672..9376c16 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ With es6 imports import client from '@craftzing/akeneo-api'; const akeneo = client({ - baseURL, + url, username, password, clientId, diff --git a/package.json b/package.json index 70ba8e3..31c3f84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@craftzing/akeneo-api", - "version": "1.0.3", + "version": "1.0.4", "description": "A Node Rest Client for the Akeneo PIM", "author": "Jens Verbeken ", "license": "MIT", diff --git a/src/http-client.ts b/src/http-client.ts index ca6ee89..f791ed7 100644 --- a/src/http-client.ts +++ b/src/http-client.ts @@ -27,7 +27,10 @@ const defaultConfig = { */ const createHttpClient = (options: ClientParams): AxiosInstance => { let accessToken = ''; - const { url: baseURL, clientId, secret, username, password } = options; + const { url, clientId, secret, username, password } = options; + + const baseURL = url.endsWith('/') ? url.substr(0, url.length - 1) : url; + const instance = axios.create({ ...defaultConfig, ...(options.axiosOptions || {}), diff --git a/src/index.ts b/src/index.ts index 8e7546c..eab7792 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,7 +31,7 @@ const wrap =

, R>( * * ```javascript * const client = akeneo({ - * baseURL: AKENEO_API_URL, + * url: AKENEO_API_URL, * username: AKENEO_USERNAME, * password: AKENEO_PASSWORD, * clientId: AKENEO_CLIENT_ID, @@ -175,7 +175,7 @@ export const createClient = (params: ClientParams) => { }; }; -export type AkeneoClientAPI = ReturnType; +export type ClientAPI = ReturnType; export * from './types'; export default createClient;