Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.07.03

### Modified
- [organizationUnit] Change the URL Endpoint BasePath

## [3.204.0] - 2025.07.02

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
20 changes: 8 additions & 12 deletions src/organisationUnit/organizationUnitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type OrganizationUnitClientActionType = {
};

export class OrganizationUnitClient extends AbstractRestfulClient {
protected basePath = '/partners/organizationUnits';
protected basePath = '/organizationUnit';

public async getList(
perPage = 25,
Expand All @@ -46,20 +46,20 @@ export class OrganizationUnitClient extends AbstractRestfulClient {
}

public async getOne(
organizationUnitRef: string,
ouRef: string,
parameters: Parameters = {},
): Promise<GetResult<OrganizationUnit>> {
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<GetResult<OrganizationUnit>> {
this.path = `/${organizationUnitRef}`;
this.path = `/ouRef/${ouRef}`;

return new GetResult(
OrganizationUnit,
Expand All @@ -68,10 +68,10 @@ export class OrganizationUnitClient extends AbstractRestfulClient {
}

public async deleteOne(
organizationUnitRef: string,
ouRef: string,
parameters: Parameters = {},
): Promise<void> {
this.path = `/${organizationUnitRef}`;
this.path = `/ouRef/${ouRef}`;

return await this.delete(parameters);
}
Expand All @@ -82,12 +82,8 @@ export class OrganizationUnitClient extends AbstractRestfulClient {
payload: OrganizationUnitClientActionType,
parameters: Parameters = {},
): Promise<void> {
this.basePath = '/organizationUnit';
this.path = `/${action}/${organizationUnitRef}`;

const response = await this.patch<void>(payload, parameters);
this.basePath = '/partners/organizationUnits';

return response;
return await this.patch<void>(payload, parameters);
}
}
6 changes: 3 additions & 3 deletions tests/organizationUnit/organizationUnits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/*',
Expand Down
Loading