@short.io/client-node 1.0.3 → 2.0.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,6 +1,7 @@
1
1
  # Short.io Node.js SDK
2
2
 
3
3
  The Short.io Node.js official SDK client is a library that allows you to integrate [short.io](https://short.io) URL shortening and link management API with your Node.js application in an easy and elegant way.
4
+ This SDK contains methods for working with links and domains.
4
5
 
5
6
  ## API reference
6
7
 
@@ -8,7 +9,7 @@ See the [API docs](https://developers.short.io/reference) for more information.
8
9
 
9
10
  ## Installing
10
11
 
11
- To install this package, type:
12
+ To install the SDK, run:
12
13
 
13
14
  ```sh
14
15
  npm i @short.io/client-node
@@ -17,34 +18,48 @@ npm i @short.io/client-node
17
18
  ## Getting Started
18
19
 
19
20
  First you need to get your API key from the Short.io dashboard in the [Integrations & API](https://app.short.io/settings/integrations/api-key) section.
20
- This SDK contains methods for working with links, domains and statistics. Import the Shortio class:
21
+ Then you need to set the configuration for the client:
21
22
 
22
23
  ```js
23
- import { Shortio } from "shortio";
24
+ import { client } from "@short.io/client-node";
25
+
26
+ client.setConfig({
27
+ baseUrl: "https://api.short.io",
28
+ headers: {
29
+ Authorization: "YOUR_API_KEY",
30
+ },
31
+ });
24
32
  ```
25
33
 
26
34
  ## Usage
27
35
 
28
- Then create an instance of the Shortio class, and pass your API key as the first parameter:
36
+ Import the needed methods from the SDK and use them in your code:
29
37
 
30
38
  ```js
31
- const shortio = new Shortio("YOUR_API_KEY");
39
+ import {
40
+ client,
41
+ getApiDomains,
42
+ getLinksExpand,
43
+ // and other needed methods
44
+ } from "@short.io/client-node";
32
45
  ```
33
46
 
34
- To get the domain list, you can use the following code:
47
+ Pass created client to the methods:
35
48
 
36
49
  ```js
37
- const domains = await shortio.domain.list();
50
+ const domainsResp = await getApiDomains({ client });
38
51
  ```
39
52
 
40
- Get the link list of the first domain above:
53
+ `domainsResp.data` will contain the list of domains.
41
54
 
42
55
  ```js
43
- const links = await shortio.link.list(domains[0].id);
56
+ const linkResp = await getLinksExpand({
57
+ client,
58
+ query: {
59
+ domain: "your_domain.com",
60
+ path: "lnk_abc123_abcde12345,
61
+ },
62
+ });
44
63
  ```
45
64
 
46
- Get the link statistics of the first link above:
47
-
48
- ```js
49
- const stats = await shortio.statistics.getByLink(links[0].idString);
50
- ```
65
+ `linkResp.data` will contain the expanded link.
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@short.io/client-node",
3
- "version": "1.0.3",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "types": "dist/index.d.ts",
9
9
  "scripts": {
10
- "compile": "tsc",
11
- "format": "eslint --cache --ext .ts . && prettier --write \"src/**/*.ts\"",
12
- "prepare": "npm run compile",
13
- "prepublishOnly": "npm run format && npm version patch"
10
+ "generate": "node --experimental-strip-types openapi/fetch.ts && openapi-ts -f openapi/config.ts",
11
+ "compile": "tsc && tsc-alias",
12
+ "prepare": "npm run compile"
14
13
  },
15
14
  "repository": {
16
15
  "type": "git",
@@ -18,7 +17,10 @@
18
17
  },
19
18
  "keywords": [
20
19
  "short.io",
21
- "api"
20
+ "api",
21
+ "client",
22
+ "node",
23
+ "sdk"
22
24
  ],
23
25
  "author": "",
24
26
  "license": "ISC",
@@ -28,9 +30,17 @@
28
30
  "homepage": "https://github.com/Short-io/client-node#readme",
29
31
  "prettier": "@short.io/eslint-config/prettier",
30
32
  "devDependencies": {
31
- "@short.io/eslint-config": "npm:@short.io/style-guide@^1.5.0",
32
- "@types/node": "^18.14.0",
33
- "eslint": "^8.34.0",
34
- "typescript": "^5.0.0"
35
- }
33
+ "@eslint/js": "^9.16.0",
34
+ "@hey-api/openapi-ts": "^0.58.0",
35
+ "@types/node": "^22.10.1",
36
+ "eslint": "^9.16.0",
37
+ "globals": "^15.13.0",
38
+ "tsc-alias": "^1.8.10",
39
+ "typescript": "^5.7.2",
40
+ "typescript-eslint": "^8.17.0"
41
+ },
42
+ "dependencies": {
43
+ "@hey-api/client-fetch": "^0.5.0"
44
+ },
45
+ "packageManager": "yarn@1.22.22+sha256.c17d3797fb9a9115bf375e31bfd30058cac6bc9c3b8807a3d8cb2094794b51ca"
36
46
  }