@mittwald/api-client 2.0.22 → 3.0.2

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.
@@ -899,7 +899,7 @@ export declare module MittwaldAPIV2 {
899
899
  /**
900
900
  * A list of errors that occurred while validating the ingress's dns before requesting a certificate.
901
901
  */
902
- dnsValidationErrors: ("ERROR_UNSPECIFIED" | "ERROR_QUAD_A" | "ERROR_NO_A_RECORD")[];
902
+ dnsValidationErrors: ("ERROR_UNSPECIFIED" | "ERROR_QUAD_A" | "ERROR_NO_A_RECORD" | "ERROR_ACME_CERTIFICATE_REQUEST_DEADLINE_EXCEEDED")[];
903
903
  hostname: string;
904
904
  id: string;
905
905
  ips: {
package/dist/cjs/v2.d.ts CHANGED
@@ -3,6 +3,7 @@ export type { MittwaldAPIV2 } from "./generated/v2/types.js";
3
3
  export declare class MittwaldAPIClient extends MittwaldApiV2Client {
4
4
  private readonly apiToken;
5
5
  private constructor();
6
+ private static createAxiosDefaults;
6
7
  private setupInterceptors;
7
8
  static newUnauthenticated(): MittwaldAPIClient;
8
9
  static newWithToken(apiToken: string): MittwaldAPIClient;
package/dist/cjs/v2.js CHANGED
@@ -13,18 +13,25 @@ exports.MittwaldAPIClient = void 0;
13
13
  const api_client_commons_1 = require("@mittwald/api-client-commons");
14
14
  const client_js_1 = require("./generated/v2/client.js");
15
15
  const version_js_1 = require("./version.js");
16
+ const browser_or_node_1 = require("browser-or-node");
16
17
  const defaultUserAgent = "mittwald-api-client/" + version_js_1.MittwaldAPIClientVersion;
17
18
  class MittwaldAPIClient extends client_js_1.default {
18
19
  constructor(apiToken) {
19
- super({
20
- baseURL: "https://api.mittwald.de/",
21
- headers: {
22
- "User-Agent": defaultUserAgent,
23
- },
24
- });
20
+ super(MittwaldAPIClient.createAxiosDefaults());
25
21
  this.apiToken = apiToken;
26
22
  this.setupInterceptors();
27
23
  }
24
+ static createAxiosDefaults() {
25
+ const headers = {};
26
+ // Setting user agent is not allowed in browser environment
27
+ if (!browser_or_node_1.isBrowser) {
28
+ headers["User-Agent"] = defaultUserAgent;
29
+ }
30
+ return {
31
+ baseURL: "https://api.mittwald.de/",
32
+ headers: headers,
33
+ };
34
+ }
28
35
  setupInterceptors() {
29
36
  this.axios.interceptors.request.use((conf) => {
30
37
  const token = this.apiToken;