From 54eb28fb61c498448aaabc36fa47030ece822273 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 16 Apr 2025 17:52:44 +0200 Subject: [PATCH 1/2] change URL basePath for orgUnit endpoints --- CHANGELOG.md | 5 +++++ .../organizationUnitClient.ts | 20 ++++++++----------- .../organizationUnits.test.ts | 6 +++--- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33ca228d..f49d1923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.205.0] - 2025.04.16 + +### Modified +- [organizationUnit] Change the URL Endpoint BasePath + ## [3.204.0] - 2025.07.02 ### Added diff --git a/src/organisationUnit/organizationUnitClient.ts b/src/organisationUnit/organizationUnitClient.ts index 11fa098c..716551a3 100644 --- a/src/organisationUnit/organizationUnitClient.ts +++ b/src/organisationUnit/organizationUnitClient.ts @@ -22,7 +22,7 @@ export type OrganizationUnitClientActionType = { }; export class OrganizationUnitClient extends AbstractRestfulClient { - protected basePath = '/partners/organizationUnits'; + protected basePath = '/organizationUnit'; public async getList( perPage = 25, @@ -46,20 +46,20 @@ export class OrganizationUnitClient extends AbstractRestfulClient { } public async getOne( - organizationUnitRef: string, + ouRef: string, parameters: Parameters = {}, ): Promise> { - this.path = `/${organizationUnitRef}`; + this.path = `/ouRef/${ouRef}`; return new GetResult(OrganizationUnit, await this.get(parameters)); } public async update( - organizationUnitRef: string, + ouRef: string, payload: OrganizationUnitPayloadType, parameters: Parameters = {}, ): Promise> { - this.path = `/${organizationUnitRef}`; + this.path = `/ouRef/${ouRef}`; return new GetResult( OrganizationUnit, @@ -68,10 +68,10 @@ export class OrganizationUnitClient extends AbstractRestfulClient { } public async deleteOne( - organizationUnitRef: string, + ouRef: string, parameters: Parameters = {}, ): Promise { - this.path = `/${organizationUnitRef}`; + this.path = `/ouRef/${ouRef}`; return await this.delete(parameters); } @@ -82,12 +82,8 @@ export class OrganizationUnitClient extends AbstractRestfulClient { payload: OrganizationUnitClientActionType, parameters: Parameters = {}, ): Promise { - this.basePath = '/organizationUnit'; this.path = `/${action}/${organizationUnitRef}`; - const response = await this.patch(payload, parameters); - this.basePath = '/partners/organizationUnits'; - - return response; + return await this.patch(payload, parameters); } } diff --git a/tests/organizationUnit/organizationUnits.test.ts b/tests/organizationUnit/organizationUnits.test.ts index a72adf22..319862ed 100644 --- a/tests/organizationUnit/organizationUnits.test.ts +++ b/tests/organizationUnit/organizationUnits.test.ts @@ -18,10 +18,10 @@ import { ORGANIZATION_UNIT_PATCH_MOCK } from './mocks/update.mocks'; import { constants } from 'http2'; import { beforeEach } from 'mocha'; -export const ORGANIZATION_UNIT_MOCK_URL = 'https://organizationUnits.localhost'; -export const ORGANIZATION_UNIT_DEFAULT = '/partners/organizationUnits'; +export const ORGANIZATION_UNIT_MOCK_URL = 'https://organizationUnit.localhost'; +export const ORGANIZATION_UNIT_DEFAULT = '/organizationUnit'; export const ORGANIZATION_UNIT_WITH_PARAMETERS = new RegExp( - '/partners/organizationUnits/*/*', + '/organizationUnit/*/*', ); export const ORGANIZATION_UNIT_NEW_ENDPOINT_WITH_PARAMETERS = new RegExp( '/organizationUnit/*', From 97f8270898f6ca69efde6dec8fbccffe9fea97ec Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 17 Apr 2025 10:38:13 +0200 Subject: [PATCH 2/2] chore(package): version 3.205.0 --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f49d1923..79234c1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [3.205.0] - 2025.04.16 +## [3.205.0] - 2025.07.03 ### Modified - [organizationUnit] Change the URL Endpoint BasePath diff --git a/package.json b/package.json index 6655f28f..4ea6007a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "type": "git", "url": "https://github.com/ArrowSphere/nodejs-api-client.git" }, - "version": "3.204.0", + "version": "3.205.0", "description": "Node.js client for ArrowSphere's public API", "main": "build/index.js", "types": "build/index.d.ts",