@mittwald/api-client 4.405.0 → 4.405.1

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * as Descriptors from "../generated/v2/descriptors.js";
2
+ export { MittwaldAPIClient } from "./default.js";
@@ -0,0 +1,38 @@
1
+ import { withAccessToken, withEventConsistencyHandling, } from "@mittwald/api-client-commons";
2
+ import { isBrowser } from "browser-or-node";
3
+ import MittwaldApiV3NextClient from "../generated/v3-next/client.js";
4
+ import { MittwaldAPIClientVersion } from "../version.js";
5
+ const defaultUserAgent = "mittwald-api-client/" + MittwaldAPIClientVersion;
6
+ export class MittwaldAPIClient extends MittwaldApiV3NextClient {
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
+ withAccessToken(this, this.apiToken);
26
+ }
27
+ static newUnauthenticated() {
28
+ return new MittwaldAPIClient();
29
+ }
30
+ static newWithToken(apiToken) {
31
+ return new MittwaldAPIClient(apiToken);
32
+ }
33
+ withEventConsistencyHandling() {
34
+ withEventConsistencyHandling(this);
35
+ return this;
36
+ }
37
+ }
38
+ export default MittwaldAPIClient;
@@ -0,0 +1,2 @@
1
+ export * as Descriptors from "../generated/v3-next/descriptors.js";
2
+ export { MittwaldAPIClient } from "./default.js";
@@ -0,0 +1,3 @@
1
+ import { MittwaldAPIV3NextClientReact as MittwaldAPIClientReact } from "../generated/v3-next/client-react.js";
2
+ export { MittwaldAPIV3NextClientReact as MittwaldAPIClientReact } from "../generated/v3-next/client-react.js";
3
+ export default MittwaldAPIClientReact;
@@ -1 +1 @@
1
- export const MittwaldAPIClientVersion = '4.404.0';
1
+ export const MittwaldAPIClientVersion = '4.405.0';