@mittwald/api-client 3.1.55 → 3.1.57
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 +2 -2
- package/dist/generated/v2/client-react.js +355 -0
- package/dist/generated/v2/client.js +662 -0
- package/dist/generated/v2/descriptors.js +1806 -0
- package/dist/generated/v2/types.js +1 -0
- package/dist/index.js +2 -0
- package/dist/react.js +1 -0
- package/dist/v2/default.js +53 -0
- package/dist/v2/react.js +3 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +18 -23
- package/dist/index.d.mts +0 -16
- package/dist/index.d.ts +0 -16
- package/dist/index.mjs +0 -1182
- package/dist/react.d.mts +0 -2072
- package/dist/react.d.ts +0 -2072
- package/dist/react.mjs +0 -754
- package/dist/shared/api-client.c88429e1.d.mts +0 -26269
- package/dist/shared/api-client.c88429e1.d.ts +0 -26269
- package/dist/shared/api-client.f43cba45.mjs +0 -1497
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
package/dist/react.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MittwaldAPIClientReact as MittwaldAPIV2ClientReact } from "./v2/react.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ApiClientError, } from "@mittwald/api-client-commons";
|
|
2
|
+
import MittwaldApiV2Client from "../generated/v2/client.js";
|
|
3
|
+
import { MittwaldAPIClientVersion } from "../version.js";
|
|
4
|
+
import { isBrowser } from "browser-or-node";
|
|
5
|
+
const defaultUserAgent = "mittwald-api-client/" + MittwaldAPIClientVersion;
|
|
6
|
+
export class MittwaldAPIClient extends MittwaldApiV2Client {
|
|
7
|
+
apiToken;
|
|
8
|
+
constructor(apiToken) {
|
|
9
|
+
super(MittwaldAPIClient.createAxiosDefaults());
|
|
10
|
+
this.apiToken = apiToken;
|
|
11
|
+
this.setupInterceptors();
|
|
12
|
+
}
|
|
13
|
+
static createAxiosDefaults() {
|
|
14
|
+
const headers = {};
|
|
15
|
+
// Setting user agent is not allowed in browser environment
|
|
16
|
+
if (!isBrowser) {
|
|
17
|
+
headers["User-Agent"] = defaultUserAgent;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
baseURL: "https://api.mittwald.de/",
|
|
21
|
+
headers: headers,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
setupInterceptors() {
|
|
25
|
+
this.axios.interceptors.request.use((conf) => {
|
|
26
|
+
const token = this.apiToken;
|
|
27
|
+
if (token) {
|
|
28
|
+
conf.headers.set("x-access-token", token);
|
|
29
|
+
}
|
|
30
|
+
return conf;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
static newUnauthenticated() {
|
|
34
|
+
return new MittwaldAPIClient();
|
|
35
|
+
}
|
|
36
|
+
static newWithToken(apiToken) {
|
|
37
|
+
return new MittwaldAPIClient(apiToken);
|
|
38
|
+
}
|
|
39
|
+
static async newWithCredentials(email, password) {
|
|
40
|
+
const client = MittwaldAPIClient.newUnauthenticated();
|
|
41
|
+
const authResult = await client.user.authenticate({
|
|
42
|
+
data: {
|
|
43
|
+
email,
|
|
44
|
+
password,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
if (authResult.status === 200) {
|
|
48
|
+
return new MittwaldAPIClient(authResult.data.token);
|
|
49
|
+
}
|
|
50
|
+
throw ApiClientError.fromResponse("Login failed", authResult);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export default MittwaldAPIClient;
|
package/dist/v2/react.js
ADDED
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MittwaldAPIClientVersion = '3.1.
|
|
1
|
+
export declare const MittwaldAPIClientVersion = '3.1.57';
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const MittwaldAPIClientVersion = '3.1.
|
|
1
|
+
export const MittwaldAPIClientVersion = '3.1.57';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/api-client",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.57",
|
|
4
4
|
"author": "Mittwald CM Service GmbH & Co. KG <opensource@mittwald.de>",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Auto-generated client for the mittwald API",
|
|
@@ -19,19 +19,20 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./dist/index.d.
|
|
23
|
-
"default": "./dist/index.
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./react": {
|
|
26
|
-
"types": "./dist/react.d.
|
|
27
|
-
"default": "./dist/react.
|
|
26
|
+
"types": "./dist/react.d.ts",
|
|
27
|
+
"default": "./dist/react.js"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
|
-
"build": "
|
|
34
|
+
"build": "run build:clean && run tsc",
|
|
35
|
+
"build:clean": "rimraf dist",
|
|
35
36
|
"build-dev": "yarn build",
|
|
36
37
|
"format": "prettier --write '**/*.{ts,tsx,yaml,yml,json,md,mdx,js}'",
|
|
37
38
|
"generate:client": "yarn acg generate --name MittwaldAPIV2 spec/openapi.json src/generated/v2 --optionalHeader x-access-token",
|
|
@@ -47,22 +48,23 @@
|
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@mittwald/api-code-generator": "1.0.0",
|
|
50
|
-
"@mittwald/react-use-promise": "^2.
|
|
51
|
-
"@types/react": "^18",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
53
|
-
"@typescript-eslint/parser": "^
|
|
51
|
+
"@mittwald/react-use-promise": "^2.3.12",
|
|
52
|
+
"@types/react": "^18.2.57",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
|
54
|
+
"@typescript-eslint/parser": "^7.0.2",
|
|
54
55
|
"concurrently": "^8.2.2",
|
|
55
|
-
"eslint": "^8.
|
|
56
|
-
"eslint-config-prettier": "^9.
|
|
56
|
+
"eslint": "^8.56.0",
|
|
57
|
+
"eslint-config-prettier": "^9.1.0",
|
|
57
58
|
"eslint-plugin-json": "^3.1.0",
|
|
58
|
-
"eslint-plugin-prettier": "^5.
|
|
59
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
59
60
|
"has-flag": "^5.0.1",
|
|
60
|
-
"prettier": "^3.
|
|
61
|
-
"prettier-plugin-jsdoc": "^1.
|
|
61
|
+
"prettier": "^3.2.5",
|
|
62
|
+
"prettier-plugin-jsdoc": "^1.3.0",
|
|
62
63
|
"prettier-plugin-pkgsort": "^0.2.1",
|
|
63
64
|
"prettier-plugin-sort-json": "^3.1.0",
|
|
64
65
|
"react": "^18.2.0",
|
|
65
|
-
"
|
|
66
|
+
"rimraf": "^5.0.5",
|
|
67
|
+
"typescript": "5.3.3"
|
|
66
68
|
},
|
|
67
69
|
"peerDependencies": {
|
|
68
70
|
"@mittwald/react-use-promise": "^1.3.2"
|
|
@@ -115,12 +117,5 @@
|
|
|
115
117
|
]
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
|
-
},
|
|
119
|
-
"unbuild": {
|
|
120
|
-
"declaration": true,
|
|
121
|
-
"externals": [
|
|
122
|
-
"type-fest",
|
|
123
|
-
"axios"
|
|
124
|
-
]
|
|
125
120
|
}
|
|
126
121
|
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { assertStatus } from '@mittwald/api-client-commons';
|
|
2
|
-
import { M as MittwaldAPIV2Client } from './shared/api-client.c88429e1.mjs';
|
|
3
|
-
export { a as MittwaldAPIV2 } from './shared/api-client.c88429e1.mjs';
|
|
4
|
-
import 'axios';
|
|
5
|
-
|
|
6
|
-
declare class MittwaldAPIClient extends MittwaldAPIV2Client {
|
|
7
|
-
private readonly apiToken;
|
|
8
|
-
private constructor();
|
|
9
|
-
private static createAxiosDefaults;
|
|
10
|
-
private setupInterceptors;
|
|
11
|
-
static newUnauthenticated(): MittwaldAPIClient;
|
|
12
|
-
static newWithToken(apiToken: string): MittwaldAPIClient;
|
|
13
|
-
static newWithCredentials(email: string, password: string): Promise<MittwaldAPIClient>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { MittwaldAPIClient as MittwaldAPIV2Client };
|
package/dist/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { assertStatus } from '@mittwald/api-client-commons';
|
|
2
|
-
import { M as MittwaldAPIV2Client } from './shared/api-client.c88429e1.js';
|
|
3
|
-
export { a as MittwaldAPIV2 } from './shared/api-client.c88429e1.js';
|
|
4
|
-
import 'axios';
|
|
5
|
-
|
|
6
|
-
declare class MittwaldAPIClient extends MittwaldAPIV2Client {
|
|
7
|
-
private readonly apiToken;
|
|
8
|
-
private constructor();
|
|
9
|
-
private static createAxiosDefaults;
|
|
10
|
-
private setupInterceptors;
|
|
11
|
-
static newUnauthenticated(): MittwaldAPIClient;
|
|
12
|
-
static newWithToken(apiToken: string): MittwaldAPIClient;
|
|
13
|
-
static newWithCredentials(email: string, password: string): Promise<MittwaldAPIClient>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { MittwaldAPIClient as MittwaldAPIV2Client };
|