Skip to content

Commit fbc6f58

Browse files
authored
fix: ignore tsconfig in npm (#12)
* fix: ignore tsconfig in npm * docs: `README`, functions.md * docs: mark JSDoc internal and private * docs(README): absolute link for functions.md
1 parent 8a77324 commit fbc6f58

File tree

9 files changed

+1917
-8
lines changed

9 files changed

+1917
-8
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
run: |
2929
npm ci
3030
npm run build
31+
32+
# - name: Generate docs
33+
# if: ${{ steps.release.outputs.release_created }}
34+
# run: |
35+
# npm run generate-docs
36+
3137
- name: NPM Publish
3238
if: ${{ steps.release.outputs.release_created }}
3339
run: npm publish --access public

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ examples
99
.prettierrc.json
1010
commitlint.config.cjs
1111
lint-staged.config.cjs
12+
tsconfig.json
1213

1314
# Husky Git Hooks
1415
.husky

README.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,52 @@
1-
# web-api-client
1+
# @cryptlex/web-api-client
2+
3+
[![latest-npm-version](https://badge.fury.io/js/@cryptlex%2Fweb-api-client.svg)](https://www.npmjs.com/package/@cryptlex/web-api-client) ![build](https://github.com/cryptlex/web-api-client-js/actions/workflows/release.yml/badge.svg)
4+
5+
The Cryptlex Web API Client library provides access to the Cryptlex Web API from applications written in JavaScript. The library maintains types for supporting TypeScript(=>3.5).
6+
7+
# Requirements
8+
9+
Node 14 or higher
10+
11+
# Installation
12+
13+
```
14+
npm install @cryptlex/web-api-client
15+
```
16+
17+
# Usage
18+
19+
The library needs to be configured with the a valid access token. This is done in the `CryptlexWebApiClientOptions` instantiation.
20+
21+
```ts
22+
import {
23+
CryptlexWebApiClient,
24+
CryptlexWebApiClientOptions,
25+
} from "@cryptlex/web-api-client";
26+
27+
const ACCESS_TOKEN = "**ACCESS_TOKEN**";
28+
const PRODUCT_ID = "**PRODUCT_ID**";
29+
30+
const cryptlexWebApiClientOptions = new CryptlexWebApiClientOptions(
31+
ACCESS_TOKEN
32+
);
33+
const cryptlexWebApiClient = new CryptlexWebApiClient(
34+
cryptlexWebApiClientOptions
35+
);
36+
37+
try {
38+
// Create a license in the product defined by PRODUCT_ID
39+
const licenseResponse = await cryptlexWebApiClient.createLicense({
40+
productId: PRODUCT_ID,
41+
});
42+
console.log(
43+
"\nSuccessfully created license: " + JSON.stringify(licenseResponse.data)
44+
);
45+
} catch (error) {
46+
console.error(error);
47+
}
48+
```
49+
50+
# Functions
51+
52+
The extent of this library can be seen in the [complete list of functions](https://github.com/cryptlex/web-api-client-js/blob/main/docs/functions.md) available.

docs/functions.md

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
## Functions
2+
3+
<dl>
4+
<dt><a href="#createLicense">createLicense(license)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code></dt>
5+
<dd><p>Create a license.</p>
6+
</dd>
7+
<dt><a href="#updateLicense">updateLicense(id, license)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code></dt>
8+
<dd><p>Updates the specified license by setting the values of the existing license to the properties passed.
9+
Any properties not provided will be left unchanged.</p>
10+
</dd>
11+
<dt><a href="#deleteLicense">deleteLicense(id)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code></dt>
12+
<dd><p>Permanently deletes a license. WRANING: This cannot be undone.</p>
13+
</dd>
14+
<dt><a href="#getLicenses">getLicenses(page, limit, parameters)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;Array.&lt;LicenseResponse&gt;&gt;&gt;</code></dt>
15+
<dd><p>Returns a list of licenses. The licenses are returned sorted by creation date in ascending order.</p>
16+
</dd>
17+
<dt><a href="#getLicense">getLicense(id)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code></dt>
18+
<dd><p>Retrieves the details of an existing license.</p>
19+
</dd>
20+
<dt><a href="#renewLicense">renewLicense(id)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code></dt>
21+
<dd><p>Extends the license expiry by it&#39;s validity.</p>
22+
</dd>
23+
<dt><a href="#extendLicense">extendLicense(id, extensionLength)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code></dt>
24+
<dd><p>Extends the license expiry by extension length.</p>
25+
</dd>
26+
<dt><a href="#createUser">createUser(user)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code></dt>
27+
<dd><p>Creates a new user.</p>
28+
</dd>
29+
<dt><a href="#deleteUser">deleteUser(id)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;any&gt;&gt;</code></dt>
30+
<dd><p>Permanently deletes an user. It cannot be undone.</p>
31+
</dd>
32+
<dt><a href="#getUser">getUser(id)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code></dt>
33+
<dd><p>Retrieves the details of an existing user.</p>
34+
</dd>
35+
<dt><a href="#getUsers">getUsers(page, limit, parameters)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;Array.&lt;UserResponse&gt;&gt;&gt;</code></dt>
36+
<dd><p>Returns a list of users. The users are returned sorted by creation date in ascending order.</p>
37+
</dd>
38+
<dt><a href="#updateUser">updateUser(id, user)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code></dt>
39+
<dd><p>Updates the specified user by setting the values of the parameters passed. Any parameters not provided will be left unchanged.</p>
40+
</dd>
41+
<dt><a href="#generateResetPasswordToken">generateResetPasswordToken(id)</a> ⇒ <code>Promise.&lt;ApiResponse.&lt;any&gt;&gt;</code></dt>
42+
<dd><p>Generates the reset password token (url encoded) for users with &#39;user&#39; role.
43+
It should only be used for custom portals to implement password reset.</p>
44+
</dd>
45+
</dl>
46+
47+
<a name="createLicense"></a>
48+
49+
## createLicense(license) ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code>
50+
51+
Create a license.
52+
53+
**Kind**: global function
54+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code> - Promise that resolves to the Web API response
55+
56+
| Param | Type | Description |
57+
| ------- | --------------------------------- | ------------------------ |
58+
| license | <code>LicenseCreateRequest</code> | License object to create |
59+
60+
<a name="updateLicense"></a>
61+
62+
## updateLicense(id, license) ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code>
63+
64+
Updates the specified license by setting the values of the existing license to the properties passed.
65+
Any properties not provided will be left unchanged.
66+
67+
**Kind**: global function
68+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code> - Promise that resolves to the Web API response
69+
70+
| Param | Type | Description |
71+
| ------- | --------------------------------- | ---------------------------------------------- |
72+
| id | <code>string</code> | Unique identifier for the license. |
73+
| license | <code>LicenseUpdateRequest</code> | License object containing properties to update |
74+
75+
<a name="deleteLicense"></a>
76+
77+
## deleteLicense(id) ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code>
78+
79+
Permanently deletes a license. WRANING: This cannot be undone.
80+
81+
**Kind**: global function
82+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code> - Promise that resolves to the Web API response
83+
84+
| Param | Type | Description |
85+
| ----- | ------------------- | ---------------------------------- |
86+
| id | <code>string</code> | Unique identifier for the license. |
87+
88+
<a name="getLicenses"></a>
89+
90+
## getLicenses(page, limit, parameters) ⇒ <code>Promise.&lt;ApiResponse.&lt;Array.&lt;LicenseResponse&gt;&gt;&gt;</code>
91+
92+
Returns a list of licenses. The licenses are returned sorted by creation date in ascending order.
93+
94+
**Kind**: global function
95+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;Array.&lt;LicenseResponse&gt;&gt;&gt;</code> - Promise that resolves to the Web API response
96+
97+
| Param | Type | Description |
98+
| ---------- | --------------------------------------- | ------------------------------------------------------------------------------- |
99+
| page | <code>number</code> | Page number. Starts with 1 |
100+
| limit | <code>number</code> | The number of licenses to fetch or 'Page size'. Value can be between 1 and 100. |
101+
| parameters | <code>LicenseListQueryParameters</code> | Parameters to filter the result of the list |
102+
103+
<a name="getLicense"></a>
104+
105+
## getLicense(id) ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code>
106+
107+
Retrieves the details of an existing license.
108+
109+
**Kind**: global function
110+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code> - Promise that resolves to the Web API response
111+
112+
| Param | Type | Description |
113+
| ----- | ------------------- | ---------------------------------- |
114+
| id | <code>string</code> | Unique identifier for the license. |
115+
116+
<a name="renewLicense"></a>
117+
118+
## renewLicense(id) ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code>
119+
120+
Extends the license expiry by it's validity.
121+
122+
**Kind**: global function
123+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code> - Promise that resolves to the Web API response
124+
125+
| Param | Type | Description |
126+
| ----- | ------------------- | ---------------------------------- |
127+
| id | <code>string</code> | Unique identifier for the license. |
128+
129+
<a name="extendLicense"></a>
130+
131+
## extendLicense(id, extensionLength) ⇒ <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code>
132+
133+
Extends the license expiry by extension length.
134+
135+
**Kind**: global function
136+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;LicenseResponse&gt;&gt;</code> - Promise that resolves to the Web API response
137+
138+
| Param | Type | Description |
139+
| --------------- | ------------------- | --------------------------------------------------------------------- |
140+
| id | <code>string</code> | Unique identifier for the license. |
141+
| extensionLength | <code>number</code> | License extension duration (in seconds) to extend the license expiry. |
142+
143+
<a name="createUser"></a>
144+
145+
## createUser(user) ⇒ <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code>
146+
147+
Creates a new user.
148+
149+
**Kind**: global function
150+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code> - Promise that resolves to the Web API response
151+
152+
| Param | Type | Description |
153+
| ----- | ------------------------------ | -------------------------- |
154+
| user | <code>UserCreateRequest</code> | User creation request body |
155+
156+
<a name="deleteUser"></a>
157+
158+
## deleteUser(id) ⇒ <code>Promise.&lt;ApiResponse.&lt;any&gt;&gt;</code>
159+
160+
Permanently deletes an user. It cannot be undone.
161+
162+
**Kind**: global function
163+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;any&gt;&gt;</code> - Promise that resolves to the Web API response
164+
165+
| Param | Type | Description |
166+
| ----- | ------------------- | ------------------------------- |
167+
| id | <code>string</code> | Unique identifier for the user. |
168+
169+
<a name="getUser"></a>
170+
171+
## getUser(id) ⇒ <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code>
172+
173+
Retrieves the details of an existing user.
174+
175+
**Kind**: global function
176+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code> - Promise that resolves to the Web API response
177+
178+
| Param | Type | Description |
179+
| ----- | ------------------- | ------------------------------- |
180+
| id | <code>string</code> | Unique identifier for the user. |
181+
182+
<a name="getUsers"></a>
183+
184+
## getUsers(page, limit, parameters) ⇒ <code>Promise.&lt;ApiResponse.&lt;Array.&lt;UserResponse&gt;&gt;&gt;</code>
185+
186+
Returns a list of users. The users are returned sorted by creation date in ascending order.
187+
188+
**Kind**: global function
189+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;Array.&lt;UserResponse&gt;&gt;&gt;</code> - Promise that resolves to the Web API response
190+
191+
| Param | Type | Description |
192+
| ---------- | ------------------------------------ | ------------------------------------------------------------------- |
193+
| page | <code>number</code> | The page number. |
194+
| limit | <code>number</code> | The number of records per page. Must be a number between 1 and 100. |
195+
| parameters | <code>UserListQueryParameters</code> | Parameters to filter the result of the list |
196+
197+
<a name="updateUser"></a>
198+
199+
## updateUser(id, user) ⇒ <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code>
200+
201+
Updates the specified user by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
202+
203+
**Kind**: global function
204+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;UserResponse&gt;&gt;</code> - Promise that resolves to the Web API response
205+
206+
| Param | Type | Description |
207+
| ----- | ------------------------------ | ------------------------------ |
208+
| id | <code>string</code> | Unique identifier for the user |
209+
| user | <code>UserUpdateRequest</code> | User update request object |
210+
211+
<a name="generateResetPasswordToken"></a>
212+
213+
## generateResetPasswordToken(id) ⇒ <code>Promise.&lt;ApiResponse.&lt;any&gt;&gt;</code>
214+
215+
Generates the reset password token (url encoded) for users with 'user' role.
216+
It should only be used for custom portals to implement password reset.
217+
218+
**Kind**: global function
219+
**Returns**: <code>Promise.&lt;ApiResponse.&lt;any&gt;&gt;</code> - Promise that resolves to the Web API response
220+
221+
| Param | Type | Description |
222+
| ----- | ------------------- | ------------------------------ |
223+
| id | <code>string</code> | Unique identifier for the user |

0 commit comments

Comments
 (0)