diff --git a/CHANGELOG.md b/CHANGELOG.md index 297c358..8e74b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @code.store/arcxp-sdk-ts +## 4.48.0 + +### Minor Changes + +- Add custom request function to ArcAPI + ## 4.47.2 ### Patch Changes diff --git a/package.json b/package.json index a3d55bf..ed0446c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@code.store/arcxp-sdk-ts", - "version": "4.47.2", + "version": "4.48.0", "description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.", "type": "commonjs", "main": "./dist/index.js", @@ -13,9 +13,7 @@ "url": "https://github.com/code-store-platform/arcxp-sdk-ts" }, "homepage": "https://github.com/code-store-platform/arcxp-sdk-ts", - "files": [ - "dist" - ], + "files": ["dist"], "scripts": { "build": "tsc", "format": "npx @biomejs/biome format --write .", @@ -27,11 +25,7 @@ "cs": "npx changeset && npx changeset version", "swaggerToTypes": "npx swagger-typescript-api -p ./tmp/swagger.json -o ./tmp -n swaggerTypes.ts" }, - "keywords": [ - "ArcXP", - "SDK", - "Code.Store" - ], + "keywords": ["ArcXP", "SDK", "Code.Store"], "author": "code.store", "license": "MIT", "dependencies": { diff --git a/src/api/custom/index.ts b/src/api/custom/index.ts new file mode 100644 index 0000000..34160cb --- /dev/null +++ b/src/api/custom/index.ts @@ -0,0 +1,22 @@ +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; + +export interface RequestConfig extends AxiosRequestConfig {} + +export class Custom extends ArcAbstractAPI { + constructor(options: ArcAPIOptions) { + super({ ...options, apiPath: '' }); + } + + public async request( + endpoint: `/${string}`, + config: AxiosRequestConfig = {} + ): Promise> { + const response: AxiosResponse = await this.client.request({ + url: endpoint, + ...config, + }); + + return response; + } +} diff --git a/src/api/draft/index.ts b/src/api/draft/index.ts index fa2ff78..8e3cf7e 100644 --- a/src/api/draft/index.ts +++ b/src/api/draft/index.ts @@ -1,4 +1,4 @@ -import { AStory } from '../../types/story'; +import type { AStory } from '../../types/story'; import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; import type { Circulations, diff --git a/src/api/index.ts b/src/api/index.ts index 41203c5..339ab1e 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -2,6 +2,7 @@ import type { ArcAPIOptions } from './abstract-api'; import { ArcAuthor } from './author'; import { ArcContent } from './content'; import { ArcContentOps } from './content-ops'; +import { Custom } from './custom'; import { ArcDraft } from './draft'; import { GlobalSettings } from './global-settings'; import { ArcIdentity } from './identity'; @@ -33,6 +34,7 @@ export const ArcAPI = (options: ArcAPIOptions) => { GlobalSettings: new GlobalSettings(options), Tags: new ArcTags(options), ContentOps: new ArcContentOps(options), + Custom: new Custom(options), }; return {