updown.io 3.3.8 → 3.4.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.
@@ -6,7 +6,7 @@ export declare class UpdownIO {
6
6
  constructor(options?: ClientOptions);
7
7
  /**
8
8
  * Set a new API URL.
9
- * @param newUrl The new API url
9
+ * @param newURL The new API url
10
10
  */
11
- setApiUrl(newUrl: string): void;
11
+ setApiUrl(newURL: string): void;
12
12
  }
package/dist/UpdownIO.js CHANGED
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UpdownIO = void 0;
4
- const axios_1 = require("axios");
4
+ const api_client_1 = require("@ffflorian/api-client");
5
5
  const api_1 = require("./api");
6
6
  class UpdownIO {
7
7
  constructor(options) {
8
8
  if (typeof options === 'string') {
9
9
  options = { apiKey: options };
10
10
  }
11
- this.apiClient = axios_1.default.create({
12
- baseURL: 'https://updown.io/api/',
13
- headers: Object.assign({}, (options && options.apiKey && { 'X-API-KEY': options.apiKey })),
11
+ this.apiClient = new api_client_1.APIClient('https://updown.io/api/', {
12
+ headers: Object.assign({}, ((options === null || options === void 0 ? void 0 : options.apiKey) && { 'X-API-KEY': options.apiKey })),
14
13
  });
15
14
  this.api = {
16
15
  checks: new api_1.ChecksAPI(this.apiClient),
@@ -19,11 +18,11 @@ class UpdownIO {
19
18
  }
20
19
  /**
21
20
  * Set a new API URL.
22
- * @param newUrl The new API url
21
+ * @param newURL The new API url
23
22
  */
24
- setApiUrl(newUrl) {
25
- this.api.checks.setApiUrl(newUrl);
26
- this.api.nodes.setApiUrl(newUrl);
23
+ setApiUrl(newURL) {
24
+ this.api.checks.setApiUrl(newURL);
25
+ this.api.nodes.setApiUrl(newURL);
27
26
  }
28
27
  }
29
28
  exports.UpdownIO = UpdownIO;
@@ -1,8 +1,8 @@
1
- import type { AxiosInstance } from 'axios';
1
+ import type { APIClient } from '@ffflorian/api-client';
2
2
  import type { Check, CheckOptions, Deleted, Downtime, Metrics, MetricsOptions } from '../interfaces';
3
3
  export declare class ChecksAPI {
4
4
  private readonly apiClient;
5
- constructor(apiClient: AxiosInstance);
5
+ constructor(apiClient: APIClient);
6
6
  /**
7
7
  * Add a new check.
8
8
  * @param url The URL you want to monitor.
@@ -43,9 +43,9 @@ export declare class ChecksAPI {
43
43
  getMetrics(token: string, options?: MetricsOptions): Promise<Metrics>;
44
44
  /**
45
45
  * Set a new API URL.
46
- * @param newUrl The new API url
46
+ * @param newURL The new API url
47
47
  */
48
- setApiUrl(newUrl: string): void;
48
+ setApiUrl(newURL: string): void;
49
49
  /**
50
50
  * Update a check.
51
51
  * @param token The check unique token
@@ -92,10 +92,10 @@ class ChecksAPI {
92
92
  }
93
93
  /**
94
94
  * Set a new API URL.
95
- * @param newUrl The new API url
95
+ * @param newURL The new API url
96
96
  */
97
- setApiUrl(newUrl) {
98
- this.apiClient.defaults.baseURL = newUrl;
97
+ setApiUrl(newURL) {
98
+ this.apiClient.setBaseURL(newURL);
99
99
  }
100
100
  /**
101
101
  * Update a check.
@@ -105,7 +105,7 @@ class ChecksAPI {
105
105
  updateCheck(token, options) {
106
106
  return __awaiter(this, void 0, void 0, function* () {
107
107
  const endpoint = Endpoints_1.Endpoint.checks(token);
108
- const { data } = yield this.apiClient.put(endpoint, { data: options });
108
+ const { data } = yield this.apiClient.put(endpoint, options);
109
109
  return data;
110
110
  });
111
111
  }
@@ -1,8 +1,8 @@
1
- import type { AxiosInstance } from 'axios';
1
+ import type { APIClient } from '@ffflorian/api-client';
2
2
  import type { Nodes } from '../interfaces';
3
3
  export declare class NodesAPI {
4
4
  private readonly apiClient;
5
- constructor(apiClient: AxiosInstance);
5
+ constructor(apiClient: APIClient);
6
6
  /** List all updown.io monitoring nodes IPv4 addresses. */
7
7
  getIpv4Nodes(): Promise<string[]>;
8
8
  /** List all updown.io monitoring nodes IPv6 addresses. */
@@ -11,7 +11,7 @@ export declare class NodesAPI {
11
11
  getNodes(): Promise<Nodes>;
12
12
  /**
13
13
  * Set a new API URL.
14
- * @param newUrl The new API url
14
+ * @param newURL The new API url
15
15
  */
16
- setApiUrl(newUrl: string): void;
16
+ setApiUrl(newURL: string): void;
17
17
  }
@@ -41,10 +41,10 @@ class NodesAPI {
41
41
  }
42
42
  /**
43
43
  * Set a new API URL.
44
- * @param newUrl The new API url
44
+ * @param newURL The new API url
45
45
  */
46
- setApiUrl(newUrl) {
47
- this.apiClient.defaults.baseURL = newUrl;
46
+ setApiUrl(newURL) {
47
+ this.apiClient.setBaseURL(newURL);
48
48
  }
49
49
  }
50
50
  exports.NodesAPI = NodesAPI;
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "author": "Florian Imdahl <git@ffflorian.de>",
3
3
  "dependencies": {
4
- "axios": "1.12.2"
4
+ "@ffflorian/api-client": "2.1.2"
5
5
  },
6
6
  "description": "An updown.io API client",
7
7
  "devDependencies": {
8
8
  "@types/node": "~24",
9
- "rimraf": "6.0.1",
10
- "typedoc": "0.28.13",
9
+ "rimraf": "6.1.0",
10
+ "typedoc": "0.28.14",
11
11
  "typescript": "5.9.3"
12
12
  },
13
13
  "engines": {
14
- "node": ">= 10.9"
14
+ "node": ">= 21"
15
15
  },
16
16
  "files": [
17
17
  "dist"
@@ -27,12 +27,12 @@
27
27
  "name": "updown.io",
28
28
  "repository": "https://github.com/ffflorian/api-clients/tree/main/updown.io",
29
29
  "scripts": {
30
- "build:ts": "tsc",
31
- "build:docs": "typedoc --options ../../typedoc.json --out ../../docs/packages/updown.io src/index.ts",
30
+ "build:ts": "tsc -p tsconfig.build.json",
31
+ "build:docs": "typedoc --tsconfig tsconfig.build.json --options ../../typedoc.json --out ../../docs/packages/updown.io src/index.ts",
32
32
  "clean": "rimraf dist",
33
33
  "dist": "yarn clean && yarn build:ts",
34
34
  "test": "exit 0"
35
35
  },
36
- "version": "3.3.8",
37
- "gitHead": "2ece1d399cc1f60310ff4dd4daa566df760751ed"
36
+ "version": "3.4.0",
37
+ "gitHead": "b6392f3b78cc68d334526b7ebd5f1375511c769f"
38
38
  }