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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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 .",
Expand All @@ -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": {
Expand Down
22 changes: 22 additions & 0 deletions src/api/custom/index.ts
Original file line number Diff line number Diff line change
@@ -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<T = unknown>(
endpoint: `/${string}`,
config: AxiosRequestConfig = {}
): Promise<AxiosResponse<T>> {
const response: AxiosResponse<T> = await this.client.request<T>({
url: endpoint,
...config,
});

return response;
}
}
2 changes: 1 addition & 1 deletion src/api/draft/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand Down
Loading