@ffflorian/api-client 1.0.13 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,57 +1,27 @@
1
- # api-client [![npm version](https://img.shields.io/npm/v/@ffflorian/api-client.svg)](https://www.npmjs.com/package/@ffflorian/api-client)
1
+ # api-client [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![npm version](https://img.shields.io/npm/v/@ffflorian/api-client.svg?style=flat)](https://www.npmjs.com/package/@ffflorian/api-client)
2
2
 
3
- A generic API client.
3
+ Simple API client using fetch ([Node.js](https://nodejs.org/api/globals.html#fetch) / [Web](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API))
4
4
 
5
- ### Installation
5
+ ## Prerequisites
6
6
 
7
- Run `yarn add @ffflorian/api-client` or `npm install @ffflorian/api-client`.
7
+ - [Node.js](https://nodejs.org) >= 14
8
+ - npm (preinstalled) or [yarn](https://classic.yarnpkg.com)
8
9
 
9
- ## Usage
10
+ ## Installation
10
11
 
11
- A complete documentation is available at https://ffflorian.github.io/api-clients/packages/api-client/.
12
+ ℹ️ This is a pure [ESM](https://nodejs.org/api/esm.html#introduction) module.
12
13
 
13
- ### Examples
14
+ Run `yarn global add @ffflorian/api-client` or `npm i -g @ffflorian/api-client`.
14
15
 
15
- ```ts
16
- import {APIClient} from '@ffflorian/api-client';
17
-
18
- const apiClient = new APIClient('https://example.com/api/v1');
19
-
20
- apiClient.requestService
21
- .get('/endpoint', {
22
- headers: {
23
- Authorization: 'my-api-key',
24
- },
25
- })
26
- .then(data => {
27
- // ...
28
- });
29
- ```
16
+ ## Usage
30
17
 
31
18
  ```ts
32
19
  import {APIClient} from '@ffflorian/api-client';
33
20
 
34
- const apiClient = new APIClient({
35
- apiUrl: 'https://example.com/api/v1',
36
- requestInjector: config => {
37
- const hawkHeader = hawk.client.header(config.url, config.method, {credentials});
38
- return {
39
- ...config,
40
- headers: {
41
- Authorization: hawkHeader.header,
42
- },
43
- };
44
- },
45
- });
46
-
47
- apiClient.requestService.get('/endpoint').then(data => {
48
- // ...
49
- });
50
- ```
51
-
52
- ## Build
53
-
54
- ```
55
- yarn
56
- yarn dist
21
+ const apiClient = new APIClient();
22
+ try {
23
+ const data = await apiClient.get('https://example.com');
24
+ } catch (error) {
25
+ console.error(error);
26
+ }
57
27
  ```
@@ -1,25 +1,21 @@
1
- import { RequestInjectorFn, RequestService } from './RequestService';
2
- export interface ClientOptions<T> {
3
- /** The API URL (e.g. "https://example.com/api/v1"). */
4
- apiUrl: string;
5
- /** An optional injector which alters every Axios request configuration before the request is sent. */
6
- requestInjector?: RequestInjectorFn<T>;
7
- }
8
- export declare class APIClient<T = any> {
9
- readonly requestService: RequestService<T>;
10
- private readonly options;
11
- constructor(apiUrl: string);
12
- constructor(options: ClientOptions<T>);
13
- /** Remove the request injector. */
14
- removeRequestInjector(): void;
15
- /**
16
- * Set a new API URL.
17
- * @param newUrl The new API url
18
- */
19
- setApiUrl(newUrl: string): void;
20
- /**
21
- * Set a (new) request injector.
22
- * @param requestInjector The new request injector.
23
- */
24
- setRequestInjector(requestInjector: RequestInjectorFn<T>): void;
1
+ import type { APIResponse, BasicRequestOptions, ApiClientConfig, RequestInterceptor, ResponseInterceptor, RequestOptions } from './types.js';
2
+ export declare class APIClient {
3
+ private baseUrl;
4
+ private config?;
5
+ interceptors: {
6
+ request: RequestInterceptor[];
7
+ response: ResponseInterceptor[];
8
+ };
9
+ constructor(baseUrl: string, config?: ApiClientConfig | undefined);
10
+ setBaseURL(baseUrl: string): void;
11
+ setConfig(config: Partial<RequestInit>): void;
12
+ private formatData;
13
+ request(endpoint: string, options: RequestOptions): Promise<Response>;
14
+ delete<T = any>(endpoint: string, options?: BasicRequestOptions): Promise<APIResponse<T>>;
15
+ get<T = any>(endpoint: string, options?: BasicRequestOptions): Promise<APIResponse<T>>;
16
+ head<T = any>(endpoint: string, options?: BasicRequestOptions): Promise<APIResponse<T>>;
17
+ patch<T = any>(endpoint: string, data?: any, options?: BasicRequestOptions): Promise<APIResponse<T>>;
18
+ options<T = any>(endpoint: string, options?: BasicRequestOptions): Promise<APIResponse<T>>;
19
+ post<T = any>(endpoint: string, data?: any, options?: BasicRequestOptions): Promise<APIResponse<T>>;
20
+ put<T = any>(endpoint: string, data?: any, options?: BasicRequestOptions): Promise<APIResponse<T>>;
25
21
  }
package/dist/APIClient.js CHANGED
@@ -1,35 +1,119 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APIClient = void 0;
4
- const RequestService_1 = require("./RequestService");
5
- class APIClient {
6
- constructor(options) {
7
- if (typeof options === 'string') {
8
- options = { apiUrl: options };
9
- }
10
- this.options = options;
11
- this.requestService = new RequestService_1.RequestService(options);
12
- }
13
- /** Remove the request injector. */
14
- removeRequestInjector() {
15
- delete this.options.requestInjector;
16
- this.requestService.removeRequestInjector();
17
- }
18
- /**
19
- * Set a new API URL.
20
- * @param newUrl The new API url
21
- */
22
- setApiUrl(newUrl) {
23
- this.requestService.setApiUrl(newUrl);
24
- }
25
- /**
26
- * Set a (new) request injector.
27
- * @param requestInjector The new request injector.
28
- */
29
- setRequestInjector(requestInjector) {
30
- this.options.requestInjector = requestInjector;
31
- this.requestService.setRequestInjector(requestInjector);
1
+ export class APIClient {
2
+ constructor(baseUrl, config) {
3
+ this.baseUrl = baseUrl;
4
+ this.config = config;
5
+ this.interceptors = {
6
+ request: [],
7
+ response: [],
8
+ };
9
+ }
10
+ setBaseURL(baseUrl) {
11
+ this.baseUrl = baseUrl;
12
+ }
13
+ setConfig(config) {
14
+ this.config = config;
15
+ }
16
+ formatData(response, options) {
17
+ const responseType = (options === null || options === void 0 ? void 0 : options.responseType) || 'json';
18
+ switch (responseType) {
19
+ case 'arraybuffer':
20
+ return response.arrayBuffer();
21
+ case 'blob':
22
+ return response.blob();
23
+ case 'text':
24
+ return response.text();
25
+ case 'json':
26
+ default:
27
+ return response.json();
28
+ }
29
+ }
30
+ async request(endpoint, options) {
31
+ var _a;
32
+ const url = new URL(endpoint, this.baseUrl);
33
+ if (options.params) {
34
+ for (const [key, param] of Object.entries(options.params)) {
35
+ if (param !== null && param !== undefined) {
36
+ url.searchParams.append(key, String(param));
37
+ }
38
+ }
39
+ }
40
+ let requestOptions = {
41
+ method: options.method.toUpperCase(),
42
+ ...this.config,
43
+ };
44
+ if (options.headers) {
45
+ requestOptions.headers = {
46
+ ...requestOptions.headers,
47
+ ...options.headers,
48
+ };
49
+ }
50
+ if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.auth) {
51
+ const { username, password } = this.config.auth;
52
+ const encoded = btoa(`${username}:${password}`);
53
+ requestOptions.headers = {
54
+ ...requestOptions.headers,
55
+ Authorization: `Basic ${encoded}`,
56
+ };
57
+ }
58
+ if (options.data) {
59
+ if (options.data instanceof Object) {
60
+ requestOptions.headers = {
61
+ ...requestOptions.headers,
62
+ 'Content-Type': 'application/json',
63
+ };
64
+ options.data = JSON.stringify(options.data);
65
+ }
66
+ requestOptions.body = options.data;
67
+ }
68
+ if (this.interceptors.request.length > 0) {
69
+ for (const interceptor of this.interceptors.request) {
70
+ requestOptions = await interceptor(url, requestOptions);
71
+ }
72
+ }
73
+ const response = await fetch(url, requestOptions);
74
+ if (!response.ok) {
75
+ throw new Error(`${options.method.toUpperCase()} request failed: ${response.statusText}`);
76
+ }
77
+ if (this.interceptors.response.length > 0) {
78
+ for (const interceptor of this.interceptors.response) {
79
+ await interceptor(response);
80
+ }
81
+ }
82
+ return response;
83
+ }
84
+ async delete(endpoint, options) {
85
+ const request = await this.request(endpoint, { ...options, method: 'DELETE' });
86
+ const requestData = await this.formatData(request, options);
87
+ return { data: requestData, headers: request.headers, status: request.status };
88
+ }
89
+ async get(endpoint, options) {
90
+ const request = await this.request(endpoint, { ...options, method: 'GET' });
91
+ const requestData = await this.formatData(request, options);
92
+ return { data: requestData, headers: request.headers, status: request.status };
93
+ }
94
+ async head(endpoint, options) {
95
+ const request = await this.request(endpoint, { ...options, method: 'HEAD' });
96
+ const requestData = await this.formatData(request, options);
97
+ return { data: requestData, headers: request.headers, status: request.status };
98
+ }
99
+ async patch(endpoint, data, options) {
100
+ const request = await this.request(endpoint, { ...options, data, method: 'PATCH' });
101
+ const requestData = await this.formatData(request, options);
102
+ return { data: requestData, headers: request.headers, status: request.status };
103
+ }
104
+ async options(endpoint, options) {
105
+ const request = await this.request(endpoint, { ...options, method: 'OPTIONS' });
106
+ const requestData = await this.formatData(request, options);
107
+ return { data: requestData, headers: request.headers, status: request.status };
108
+ }
109
+ async post(endpoint, data, options) {
110
+ const request = await this.request(endpoint, { data, ...options, method: 'POST' });
111
+ const requestData = await this.formatData(request, options);
112
+ return { data: requestData, headers: request.headers, status: request.status };
113
+ }
114
+ async put(endpoint, data, options) {
115
+ const request = await this.request(endpoint, { data, ...options, method: 'PUT' });
116
+ const requestData = await this.formatData(request, options);
117
+ return { data: requestData, headers: request.headers, status: request.status };
32
118
  }
33
119
  }
34
- exports.APIClient = APIClient;
35
- //# sourceMappingURL=APIClient.js.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- export * from './APIClient';
2
- export * from './APIException';
3
- export * from './RequestService';
4
- export type { AxiosRequestConfig } from 'axios';
1
+ export * from './APIClient.js';
2
+ export * from './types.js';
package/dist/index.js CHANGED
@@ -1,16 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./APIClient"), exports);
14
- __exportStar(require("./APIException"), exports);
15
- __exportStar(require("./RequestService"), exports);
16
- //# sourceMappingURL=index.js.map
1
+ export * from './APIClient.js';
2
+ export * from './types.js';
@@ -0,0 +1,22 @@
1
+ export interface RequestOptions {
2
+ data?: any;
3
+ headers?: HeadersInit;
4
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options';
5
+ params?: object;
6
+ responseType?: 'arraybuffer' | 'json' | 'text' | 'blob';
7
+ }
8
+ export type ApiClientConfig = Partial<Omit<RequestInit, 'method'>> & {
9
+ auth?: {
10
+ password: string;
11
+ username: string;
12
+ };
13
+ };
14
+ export type BasicRequestOptions = Omit<RequestOptions, 'method'>;
15
+ export type RequestInitWithMethod = Required<Pick<RequestInit, 'method'>> & Omit<RequestInit, 'method'>;
16
+ export type RequestInterceptor = (url: URL, options: RequestInitWithMethod) => RequestInitWithMethod | Promise<RequestInitWithMethod>;
17
+ export type ResponseInterceptor = (response: Response) => void | Promise<void>;
18
+ export interface APIResponse<T> {
19
+ data: T;
20
+ headers: Headers;
21
+ status: number;
22
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,37 +1,31 @@
1
1
  {
2
- "author": "Florian Keller <github@floriankeller.de>",
3
- "dependencies": {
4
- "axios": "0.19.2",
5
- "http-status-codes": "1.4.0"
6
- },
7
- "description": "A generic API client",
2
+ "author": "Florian Imdahl <git@ffflorian.de>",
3
+ "description": "Simple API client using fetch",
8
4
  "devDependencies": {
9
- "@types/node": "~14",
10
- "rimraf": "3.0.2",
11
- "typedoc": "0.17.7",
12
- "typescript": "3.9.5"
5
+ "rimraf": "6.1.0",
6
+ "typescript": "5.9.3"
13
7
  },
14
8
  "engines": {
15
- "node": ">= 10.9"
9
+ "node": ">= 18.0"
16
10
  },
11
+ "exports": "./dist/index.js",
17
12
  "files": [
18
13
  "dist"
19
14
  ],
20
15
  "keywords": [
21
- "api",
22
- "api-client"
16
+ "cli",
17
+ "typescript"
23
18
  ],
24
19
  "license": "GPL-3.0",
25
- "main": "dist/index.js",
20
+ "module": "dist/index.js",
26
21
  "name": "@ffflorian/api-client",
27
- "repository": "https://github.com/ffflorian/api-clients/tree/master/packages/api-client",
22
+ "repository": "https://github.com/ffflorian/node-packages/tree/main/packages/api-client",
28
23
  "scripts": {
29
- "build:ts": "tsc",
30
- "build:docs": "typedoc --options ../../typedoc.json --out ../../docs/packages/api-client",
24
+ "build": "tsc -p tsconfig.build.json",
31
25
  "clean": "rimraf dist",
32
- "dist": "yarn clean && yarn build:ts",
26
+ "dist": "yarn clean && yarn build",
33
27
  "test": "exit 0"
34
28
  },
35
- "version": "1.0.13",
36
- "gitHead": "06d95dac1c00b3f1ca7789ffad99bd7c269b1ebf"
29
+ "type": "module",
30
+ "version": "2.1.0"
37
31
  }
package/CHANGELOG.md DELETED
@@ -1,250 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [1.0.13](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.12...@ffflorian/api-client@1.0.13) (2020-06-24)
7
-
8
- **Note:** Version bump only for package @ffflorian/api-client
9
-
10
-
11
-
12
-
13
-
14
- ## [1.0.12](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.11...@ffflorian/api-client@1.0.12) (2020-05-24)
15
-
16
- **Note:** Version bump only for package @ffflorian/api-client
17
-
18
-
19
-
20
-
21
-
22
- ## [1.0.11](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.10...@ffflorian/api-client@1.0.11) (2020-05-13)
23
-
24
- **Note:** Version bump only for package @ffflorian/api-client
25
-
26
-
27
-
28
-
29
-
30
- ## [1.0.10](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.9...@ffflorian/api-client@1.0.10) (2020-04-27)
31
-
32
- **Note:** Version bump only for package @ffflorian/api-client
33
-
34
-
35
-
36
-
37
-
38
- ## [1.0.9](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.8...@ffflorian/api-client@1.0.9) (2020-04-26)
39
-
40
- **Note:** Version bump only for package @ffflorian/api-client
41
-
42
-
43
-
44
-
45
-
46
- ## [1.0.8](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.7...@ffflorian/api-client@1.0.8) (2020-02-13)
47
-
48
- **Note:** Version bump only for package @ffflorian/api-client
49
-
50
-
51
-
52
-
53
-
54
- ## [1.0.7](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.6...@ffflorian/api-client@1.0.7) (2020-01-22)
55
-
56
- **Note:** Version bump only for package @ffflorian/api-client
57
-
58
-
59
-
60
-
61
-
62
- ## [1.0.6](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.5...@ffflorian/api-client@1.0.6) (2020-01-17)
63
-
64
- **Note:** Version bump only for package @ffflorian/api-client
65
-
66
-
67
-
68
-
69
-
70
- ## [1.0.5](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.4...@ffflorian/api-client@1.0.5) (2020-01-16)
71
-
72
- **Note:** Version bump only for package @ffflorian/api-client
73
-
74
-
75
-
76
-
77
-
78
- ## [1.0.4](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.3...@ffflorian/api-client@1.0.4) (2020-01-15)
79
-
80
- **Note:** Version bump only for package @ffflorian/api-client
81
-
82
-
83
-
84
-
85
-
86
- ## [1.0.3](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.2...@ffflorian/api-client@1.0.3) (2019-12-18)
87
-
88
- **Note:** Version bump only for package @ffflorian/api-client
89
-
90
-
91
-
92
-
93
-
94
- ## [1.0.2](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.1...@ffflorian/api-client@1.0.2) (2019-09-11)
95
-
96
- **Note:** Version bump only for package @ffflorian/api-client
97
-
98
-
99
-
100
-
101
-
102
- ## [1.0.1](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@1.0.0...@ffflorian/api-client@1.0.1) (2019-09-01)
103
-
104
- **Note:** Version bump only for package @ffflorian/api-client
105
-
106
-
107
-
108
-
109
-
110
- # [1.0.0](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.5.1...@ffflorian/api-client@1.0.0) (2019-07-17)
111
-
112
-
113
- ### Features
114
-
115
- * Set ES6 as target and require Node >= 10.9 ([#130](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/issues/130)) ([42109dc](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/commit/42109dc))
116
-
117
-
118
- ### BREAKING CHANGES
119
-
120
- * Node.js >= 10.9 is required.
121
-
122
-
123
-
124
-
125
-
126
- ## [0.5.1](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.5.0...@ffflorian/api-client@0.5.1) (2019-07-11)
127
-
128
- **Note:** Version bump only for package @ffflorian/api-client
129
-
130
-
131
-
132
-
133
-
134
- # [0.5.0](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.4.4...@ffflorian/api-client@0.5.0) (2019-06-09)
135
-
136
-
137
- ### Features
138
-
139
- * **updown.io:** Use @ffflorian/api-client ([#98](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/issues/98)) ([a6be424](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/commit/a6be424))
140
-
141
-
142
-
143
-
144
-
145
- ## [0.4.4](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.4.3...@ffflorian/api-client@0.4.4) (2019-05-30)
146
-
147
-
148
- ### Bug Fixes
149
-
150
- * **security:** Upgrade axios to 0.19.0 ([b745299](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/commit/b745299))
151
-
152
-
153
-
154
-
155
-
156
- ## [0.4.3](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.4.2...@ffflorian/api-client@0.4.3) (2019-05-14)
157
-
158
- **Note:** Version bump only for package @ffflorian/api-client
159
-
160
-
161
-
162
-
163
-
164
- ## [0.4.2](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.4.1...@ffflorian/api-client@0.4.2) (2019-04-11)
165
-
166
- **Note:** Version bump only for package @ffflorian/api-client
167
-
168
-
169
-
170
-
171
-
172
- ## [0.4.1](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.4.0...@ffflorian/api-client@0.4.1) (2019-04-11)
173
-
174
- **Note:** Version bump only for package @ffflorian/api-client
175
-
176
-
177
-
178
-
179
-
180
- # [0.4.0](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.3.4...@ffflorian/api-client@0.4.0) (2019-04-11)
181
-
182
-
183
- ### Features
184
-
185
- * **api-client:** Add/remove a requestInjector ([#46](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/issues/46)) ([79b53e0](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/commit/79b53e0))
186
-
187
-
188
-
189
-
190
-
191
- ## [0.3.4](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.3.3...@ffflorian/api-client@0.3.4) (2019-04-05)
192
-
193
- **Note:** Version bump only for package @ffflorian/api-client
194
-
195
-
196
-
197
-
198
-
199
- ## [0.3.3](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.3.2...@ffflorian/api-client@0.3.3) (2019-04-05)
200
-
201
- **Note:** Version bump only for package @ffflorian/api-client
202
-
203
-
204
-
205
-
206
-
207
- ## [0.3.2](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.3.1...@ffflorian/api-client@0.3.2) (2019-04-03)
208
-
209
- **Note:** Version bump only for package @ffflorian/api-client
210
-
211
-
212
-
213
-
214
-
215
- ## [0.3.1](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.3.0...@ffflorian/api-client@0.3.1) (2019-03-31)
216
-
217
- **Note:** Version bump only for package @ffflorian/api-client
218
-
219
-
220
-
221
-
222
-
223
- # [0.3.0](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.2.0...@ffflorian/api-client@0.3.0) (2019-03-27)
224
-
225
-
226
- ### Features
227
-
228
- * **api-client:** Add ability to send data ([#30](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/issues/30)) ([318830b](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/commit/318830b))
229
-
230
-
231
-
232
-
233
-
234
- # [0.2.0](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/compare/@ffflorian/api-client@0.1.0...@ffflorian/api-client@0.2.0) (2019-03-20)
235
-
236
-
237
- ### Features
238
-
239
- * **api-client:** Add injector ([#25](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/issues/25)) ([9054d0a](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/commit/9054d0a))
240
-
241
-
242
-
243
-
244
-
245
- # 0.1.0 (2019-03-09)
246
-
247
-
248
- ### Features
249
-
250
- * Add APIClient ([#5](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/issues/5)) ([2bdb7d2](https://github.com/ffflorian/api-clients/tree/master/packages/api-client/commit/2bdb7d2))
@@ -1 +0,0 @@
1
- {"version":3,"file":"APIClient.js","sourceRoot":"","sources":["../src/APIClient.ts"],"names":[],"mappings":";;;AAAA,qDAAmE;AAWnE,MAAa,SAAS;IAMpB,YAAY,OAAkC;QAC5C,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,OAAO,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,CAAC;SAC7B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,IAAI,+BAAc,CAAI,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,mCAAmC;IAC5B,qBAAqB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;QACpC,IAAI,CAAC,cAAc,CAAC,qBAAqB,EAAE,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,MAAc;QAC7B,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,kBAAkB,CAAC,eAAqC;QAC7D,IAAI,CAAC,OAAO,CAAC,eAAe,GAAG,eAAe,CAAC;QAC/C,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC1D,CAAC;CACF;AArCD,8BAqCC"}
@@ -1,17 +0,0 @@
1
- import type { AxiosError } from 'axios';
2
- export declare class APIException extends Error {
3
- constructor(message?: string, serverMessage?: string);
4
- }
5
- export declare class AuthenticationError extends Error {
6
- constructor(message?: string, serverMessage?: string);
7
- }
8
- export declare class InvalidResponseError extends Error {
9
- constructor(message?: string);
10
- }
11
- export declare class NotFoundError extends Error {
12
- constructor(message?: string, serverMessage?: string);
13
- }
14
- export declare class RateLimitError extends Error {
15
- constructor(message?: string, serverMessage?: string);
16
- }
17
- export declare function ExceptionMapper(error: AxiosError): Error;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- /* eslint-disable prefer-template */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ExceptionMapper = exports.RateLimitError = exports.NotFoundError = exports.InvalidResponseError = exports.AuthenticationError = exports.APIException = void 0;
5
- const HTTP_STATUS = require("http-status-codes");
6
- class APIException extends Error {
7
- constructor(message = '', serverMessage) {
8
- super(message);
9
- this.message += serverMessage ? `. ("${serverMessage}")` : '. The server did not provide any further information.';
10
- Object.setPrototypeOf(this, new.target.prototype);
11
- }
12
- }
13
- exports.APIException = APIException;
14
- class AuthenticationError extends Error {
15
- constructor(message = '', serverMessage) {
16
- super(message);
17
- this.message += '. Wrong API key?' + (serverMessage ? ` ("${serverMessage}")` : '');
18
- Object.setPrototypeOf(this, new.target.prototype);
19
- }
20
- }
21
- exports.AuthenticationError = AuthenticationError;
22
- class InvalidResponseError extends Error {
23
- constructor(message = '') {
24
- super(message);
25
- Object.setPrototypeOf(this, new.target.prototype);
26
- }
27
- }
28
- exports.InvalidResponseError = InvalidResponseError;
29
- class NotFoundError extends Error {
30
- constructor(message = '', serverMessage) {
31
- super(message);
32
- this.message += serverMessage ? `: "${serverMessage}".` : '. The server did not provide any further information.';
33
- Object.setPrototypeOf(this, new.target.prototype);
34
- }
35
- }
36
- exports.NotFoundError = NotFoundError;
37
- class RateLimitError extends Error {
38
- constructor(message = '', serverMessage) {
39
- super(message);
40
- this.message += ': Rate limit hit.' + (serverMessage ? ` ("${serverMessage}")` : '');
41
- Object.setPrototypeOf(this, new.target.prototype);
42
- }
43
- }
44
- exports.RateLimitError = RateLimitError;
45
- function ExceptionMapper(error) {
46
- var _a, _b;
47
- if ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) {
48
- const serverMessage = ((_b = error.response.data) === null || _b === void 0 ? void 0 : _b.message) || undefined;
49
- switch (error.response.status) {
50
- case HTTP_STATUS.FORBIDDEN:
51
- return new AuthenticationError(error.message, serverMessage);
52
- case HTTP_STATUS.NOT_FOUND:
53
- return new NotFoundError(error.message, serverMessage);
54
- case HTTP_STATUS.TOO_MANY_REQUESTS:
55
- return new RateLimitError(error.message, serverMessage);
56
- default:
57
- return new APIException(error.message, serverMessage);
58
- }
59
- }
60
- if (error instanceof InvalidResponseError) {
61
- return error;
62
- }
63
- return new Error(error.message);
64
- }
65
- exports.ExceptionMapper = ExceptionMapper;
66
- //# sourceMappingURL=APIException.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"APIException.js","sourceRoot":"","sources":["../src/APIException.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;AAGpC,iDAAiD;AAEjD,MAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAO,GAAG,EAAE,EAAE,aAAsB;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,OAAO,aAAa,IAAI,CAAC,CAAC,CAAC,uDAAuD,CAAC;QACnH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAND,oCAMC;AAED,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,EAAE,EAAE,aAAsB;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,IAAI,kBAAkB,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,aAAa,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACpF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAND,kDAMC;AAED,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAO,GAAG,EAAE;QACtB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AALD,oDAKC;AAED,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAO,GAAG,EAAE,EAAE,aAAsB;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,MAAM,aAAa,IAA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KAAK,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AArBD,0CAqBC"}
@@ -1,25 +0,0 @@
1
- import { AxiosRequestConfig, AxiosResponse } from 'axios';
2
- import type { ClientOptions } from './APIClient';
3
- export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
4
- export declare type AxiosResponseWithoutData<T> = Omit<AxiosResponse<unknown>, 'data'> & T;
5
- export interface AxiosConfigWithData<T> extends AxiosRequestConfig {
6
- data?: T;
7
- }
8
- export declare type RequestInjectorFn<T> = (baseConfig: AxiosConfigWithData<T>) => AxiosConfigWithData<T> | Promise<AxiosConfigWithData<T>>;
9
- export declare type ResponseInjectorFn<T> = (response: AxiosResponseWithoutData<T>) => AxiosResponseWithoutData<T> | Promise<AxiosResponseWithoutData<T>>;
10
- export declare class RequestService<T> {
11
- private readonly config;
12
- constructor(config: ClientOptions<T>);
13
- delete<U>(url: string, options?: AxiosConfigWithData<T>): Promise<U>;
14
- get<U>(url: string, options?: AxiosConfigWithData<T>): Promise<U>;
15
- head<U>(url: string, options?: AxiosConfigWithData<T>): Promise<U>;
16
- options<U>(url: string, options?: AxiosConfigWithData<T>): Promise<U>;
17
- patch<U>(url: string, options?: AxiosConfigWithData<T>): Promise<U>;
18
- post<U>(url: string, options?: AxiosConfigWithData<T>): Promise<U>;
19
- put<U>(url: string, options?: AxiosConfigWithData<T>): Promise<U>;
20
- removeRequestInjector(): void;
21
- request<U>(config: AxiosConfigWithData<T>): Promise<AxiosResponse<U>>;
22
- setApiUrl(apiUrl: string): void;
23
- setRequestInjector(requestInjector: RequestInjectorFn<T>): void;
24
- private injectConfig;
25
- }
@@ -1,142 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RequestService = void 0;
13
- const axios_1 = require("axios");
14
- const HTTP_STATUS = require("http-status-codes");
15
- const APIException_1 = require("./APIException");
16
- var HttpMethod;
17
- (function (HttpMethod) {
18
- HttpMethod["DELETE"] = "delete";
19
- HttpMethod["GET"] = "get";
20
- HttpMethod["HEAD"] = "head";
21
- HttpMethod["OPTIONS"] = "options";
22
- HttpMethod["PATCH"] = "patch";
23
- HttpMethod["POST"] = "post";
24
- HttpMethod["PUT"] = "put";
25
- })(HttpMethod || (HttpMethod = {}));
26
- class RequestService {
27
- constructor(config) {
28
- this.config = config;
29
- }
30
- delete(url, options) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- const config = yield this.injectConfig({
33
- method: HttpMethod.DELETE,
34
- url: `${this.config.apiUrl}${url}`,
35
- }, options);
36
- const response = yield this.request(config);
37
- return response.data;
38
- });
39
- }
40
- get(url, options) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- const config = yield this.injectConfig({
43
- method: HttpMethod.GET,
44
- url: `${this.config.apiUrl}${url}`,
45
- }, options);
46
- const response = yield this.request(config);
47
- return response.data;
48
- });
49
- }
50
- head(url, options) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- const config = yield this.injectConfig({
53
- method: HttpMethod.HEAD,
54
- url: `${this.config.apiUrl}${url}`,
55
- }, options);
56
- const response = yield this.request(config);
57
- return response.data;
58
- });
59
- }
60
- options(url, options) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- const config = yield this.injectConfig({
63
- method: HttpMethod.OPTIONS,
64
- url: `${this.config.apiUrl}${url}`,
65
- }, options);
66
- const response = yield this.request(config);
67
- return response.data;
68
- });
69
- }
70
- patch(url, options) {
71
- return __awaiter(this, void 0, void 0, function* () {
72
- const config = yield this.injectConfig({
73
- method: HttpMethod.PATCH,
74
- url: `${this.config.apiUrl}${url}`,
75
- }, options);
76
- const response = yield this.request(config);
77
- return response.data;
78
- });
79
- }
80
- post(url, options) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- const config = yield this.injectConfig({
83
- method: HttpMethod.POST,
84
- url: `${this.config.apiUrl}${url}`,
85
- }, options);
86
- const response = yield this.request(config);
87
- return response.data;
88
- });
89
- }
90
- put(url, options) {
91
- return __awaiter(this, void 0, void 0, function* () {
92
- const config = yield this.injectConfig({
93
- method: HttpMethod.PUT,
94
- url: `${this.config.apiUrl}${url}`,
95
- }, options);
96
- const response = yield this.request(config);
97
- return response.data;
98
- });
99
- }
100
- removeRequestInjector() {
101
- delete this.config.requestInjector;
102
- }
103
- request(config) {
104
- return __awaiter(this, void 0, void 0, function* () {
105
- try {
106
- const response = yield axios_1.default.request(config);
107
- const contentType = response.headers['content-type'] ? String(response.headers['content-type']) : undefined;
108
- if (contentType) {
109
- if (contentType.includes('application/json') || config.responseType) {
110
- return response;
111
- }
112
- throw new APIException_1.InvalidResponseError('The server responded with invalid data: No JSON sent.');
113
- }
114
- else if (response.status === HTTP_STATUS.NO_CONTENT) {
115
- return response;
116
- }
117
- else {
118
- throw new APIException_1.InvalidResponseError('The server responded with invalid data: No Content-Type set.');
119
- }
120
- }
121
- catch (error) {
122
- throw APIException_1.ExceptionMapper(error);
123
- }
124
- });
125
- }
126
- setApiUrl(apiUrl) {
127
- this.config.apiUrl = apiUrl;
128
- }
129
- setRequestInjector(requestInjector) {
130
- this.config.requestInjector = requestInjector;
131
- }
132
- injectConfig(baseConfig, options) {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- if (typeof this.config.requestInjector === 'function') {
135
- baseConfig = yield this.config.requestInjector(baseConfig);
136
- }
137
- return Object.assign(Object.assign({}, baseConfig), options);
138
- });
139
- }
140
- }
141
- exports.RequestService = RequestService;
142
- //# sourceMappingURL=RequestService.js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