@sermas/api-client 1.0.0-alpha.15 → 1.0.0-alpha.17
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 +40 -0
- package/package.json +8 -4
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Sermas typescript API client
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm i -s @sermas/api-client
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {createSermasClient} from '@sermas/api-client'
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const main = async () => {
|
|
16
|
+
|
|
17
|
+
const client = await createSermasClient({
|
|
18
|
+
appId: 'my-app',
|
|
19
|
+
access_token: '<token>',
|
|
20
|
+
refresh_token: '<token>',
|
|
21
|
+
domain: 'http://localhost:8080',
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const res = await client.api.authentication.whoami()
|
|
25
|
+
|
|
26
|
+
console.log(`Hello from ${res.preferred_username}`)
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
main().catch(e => console.error(e))
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Development
|
|
35
|
+
|
|
36
|
+
Set the `API_URL` env and run
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
make generate
|
|
40
|
+
```
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sermas/api-client",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.17",
|
|
4
4
|
"description": "Sermas API client",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./index.
|
|
6
|
+
"main": "./index.cjs",
|
|
7
7
|
"module": "./index.mjs",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
|
-
".":
|
|
10
|
+
".": {
|
|
11
|
+
"require": "./index.cjs",
|
|
12
|
+
"import": "./index.mjs",
|
|
13
|
+
"types": "./index.d.ts"
|
|
14
|
+
},
|
|
11
15
|
"./package.json": "./package.json"
|
|
12
16
|
},
|
|
13
17
|
"repository": {
|
|
@@ -17,7 +21,7 @@
|
|
|
17
21
|
"scripts": {
|
|
18
22
|
"dev": "NODE_NO_WARNINGS=1 NODE_TLS_REJECT_UNAUTHORIZED=0 nodemon -w ./src/index.ts",
|
|
19
23
|
"clean": "rm -rf ./dist",
|
|
20
|
-
"build": "npm run clean && tsup ./src && cp package.json ./dist",
|
|
24
|
+
"build": "npm run clean && tsup ./src && cp ./package.json ./README.md ./dist",
|
|
21
25
|
"build:watch": "npm run clean && tsup --watch",
|
|
22
26
|
"test": "jest",
|
|
23
27
|
"generate:openapi": "rm -rf ./src/libs/openapi && openapi --useUnionTypes --input ./openapi.json --output ./src/libs/openapi --name SermasApi --client axios && node --loader ts-node/esm ./src/openapi-generator.ts",
|