@sharpapi/sharpapi-node-skills-database 1.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/CHANGELOG.md +6 -0
- package/CONTRIBUTION.md +53 -0
- package/LICENSE.md +7 -0
- package/README.md +351 -0
- package/package.json +36 -0
- package/src/SharpApiSkillsDatabaseService.js +132 -0
- package/src/index.js +6 -0
package/CHANGELOG.md
ADDED
package/CONTRIBUTION.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
## Contributing
|
|
2
|
+
|
|
3
|
+
We welcome contributions to the SharpAPI Node.js Skills Database SDK! If you'd like to contribute, please follow these steps:
|
|
4
|
+
|
|
5
|
+
1. **Fork the Repository**
|
|
6
|
+
|
|
7
|
+
Click the "Fork" button at the top-right corner of the repository page to create your own fork.
|
|
8
|
+
|
|
9
|
+
2. **Clone the Forked Repository**
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/yourusername/sharpapi-node-client.git
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
3. **Navigate to the Project Directory**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cd sharpapi-node-client
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
4. **Create a New Branch**
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
git checkout -b feature/your-feature-name
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
5. **Make Your Changes**
|
|
28
|
+
|
|
29
|
+
Implement your feature or bug fix.
|
|
30
|
+
|
|
31
|
+
6. **Commit Your Changes**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git add .
|
|
35
|
+
git commit -m "Add feature: Your Feature Name"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
7. **Push to Your Fork**
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git push origin feature/your-feature-name
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
8. **Create a Pull Request**
|
|
45
|
+
|
|
46
|
+
Go to the original repository on GitHub and create a pull request from your forked repository.
|
|
47
|
+
|
|
48
|
+
### Guidelines
|
|
49
|
+
|
|
50
|
+
- **Follow Coding Standards:** Ensure your code adheres to the existing coding style.
|
|
51
|
+
- **Write Tests:** Add tests for your new features or bug fixes.
|
|
52
|
+
- **Update Documentation:** If your changes affect the usage, update the documentation accordingly.
|
|
53
|
+
- **Provide Clear Descriptions:** Make sure your commit messages and pull request descriptions are clear and concise.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# SharpAPI NodeJS Skills Database SDK
|
|
4
|
+
|
|
5
|
+
## 🚀 Access a comprehensive database of professional skills with AI-powered API
|
|
6
|
+
|
|
7
|
+
### Leverage AI API to search, validate, and categorize professional skills for HR Tech, job platforms, and more.
|
|
8
|
+
|
|
9
|
+
**SharpAPI.com Node.js Skills Database SDK** enables developers to integrate access to a comprehensive database of professional skills into their Node.js applications. This SDK simplifies interaction with the SharpAPI Skills Database service, providing a seamless way to search, validate, and categorize professional skills.
|
|
10
|
+
|
|
11
|
+
See more at [SharpAPI.com Website »](https://sharpapi.com/)
|
|
12
|
+
|
|
13
|
+
[](https://www.npmjs.com/package/@sharpapi/sharpapi-node-skills-database)
|
|
14
|
+
[](https://github.com/sharpapi/sharpapi-node-client/blob/master/LICENSE.md)
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- Node.js >= 16.x
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm i @sharpapi/sharpapi-node-skills-database
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Table of Contents
|
|
29
|
+
|
|
30
|
+
1. [Installation](#installation)
|
|
31
|
+
2. [Configuration](#configuration)
|
|
32
|
+
3. [Usage](#usage)
|
|
33
|
+
- [Initialization](#initialization)
|
|
34
|
+
- [Available Methods](#available-methods)
|
|
35
|
+
4. [Examples](#examples)
|
|
36
|
+
5. [Contributing](#contributing)
|
|
37
|
+
6. [License](#license)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
### Prerequisites
|
|
44
|
+
|
|
45
|
+
- **Node.js** v16 or higher
|
|
46
|
+
- **npm** (Node Package Manager)
|
|
47
|
+
|
|
48
|
+
### Install via npm
|
|
49
|
+
|
|
50
|
+
You can install the SharpAPI Node.js Skills Database SDK using npm:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install @sharpapi/sharpapi-node-skills-database
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Install via Yarn
|
|
57
|
+
|
|
58
|
+
Alternatively, if you prefer using Yarn:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
yarn add @sharpapi/sharpapi-node-skills-database
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
### Setting Up Environment Variables
|
|
69
|
+
|
|
70
|
+
To protect your credentials, it's recommended to use a `.env` file to store your SharpAPI API key. Follow these steps:
|
|
71
|
+
|
|
72
|
+
1. **Create a `.env` File**
|
|
73
|
+
|
|
74
|
+
In the root directory of your project, create a file named `.env`:
|
|
75
|
+
|
|
76
|
+
```plaintext
|
|
77
|
+
SHARP_API_KEY=your_actual_api_key_here
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
2. **Install `dotenv` Package**
|
|
81
|
+
|
|
82
|
+
To load environment variables from the `.env` file, install the `dotenv` package:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm install dotenv
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
3. **Load Environment Variables**
|
|
89
|
+
|
|
90
|
+
At the beginning of your application (e.g., in `app.js` or `index.js`), add the following line to load the environment variables:
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
require('dotenv').config();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
4. **Ensure `.env` is Ignored**
|
|
97
|
+
|
|
98
|
+
Add `.env` to your `.gitignore` file to prevent sensitive information from being committed to version control:
|
|
99
|
+
|
|
100
|
+
```plaintext
|
|
101
|
+
# .gitignore
|
|
102
|
+
.env
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Usage
|
|
108
|
+
|
|
109
|
+
### Initialization
|
|
110
|
+
|
|
111
|
+
First, import and initialize the `SharpApiSkillsDatabaseService` with your API key:
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
// Load environment variables
|
|
115
|
+
require('dotenv').config();
|
|
116
|
+
|
|
117
|
+
// Import the SharpApiSkillsDatabaseService
|
|
118
|
+
const { SharpApiSkillsDatabaseService } = require('@sharpapi/sharpapi-node-skills-database');
|
|
119
|
+
|
|
120
|
+
// Initialize the SharpApiSkillsDatabaseService
|
|
121
|
+
const apiKey = process.env.SHARP_API_KEY;
|
|
122
|
+
const skillsService = new SharpApiSkillsDatabaseService(apiKey);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Available Methods
|
|
126
|
+
|
|
127
|
+
The `SharpApiSkillsDatabaseService` class provides various methods to interact with the Skills Database API:
|
|
128
|
+
|
|
129
|
+
#### getSkillById(skillId)
|
|
130
|
+
|
|
131
|
+
- **Description:** Get information about a specific skill by ID.
|
|
132
|
+
- **Parameters:**
|
|
133
|
+
- `skillId` (string): The ID of the skill.
|
|
134
|
+
- **Returns:** A Promise that resolves to the skill information.
|
|
135
|
+
- **Usage:**
|
|
136
|
+
```javascript
|
|
137
|
+
const skillInfo = await skillsService.getSkillById('skill123');
|
|
138
|
+
console.log(skillInfo);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### searchSkills(query, options)
|
|
142
|
+
|
|
143
|
+
- **Description:** Search for skills by name or keyword.
|
|
144
|
+
- **Parameters:**
|
|
145
|
+
- `query` (string): The search query.
|
|
146
|
+
- `options` (object, optional): Additional options for search.
|
|
147
|
+
- `limit` (number, optional): Maximum number of results to return (default: 20).
|
|
148
|
+
- `offset` (number, optional): Number of results to skip (default: 0).
|
|
149
|
+
- `category` (string, optional): Filter by skill category.
|
|
150
|
+
- `type` (string, optional): Filter by skill type.
|
|
151
|
+
- **Returns:** A Promise that resolves to the search results.
|
|
152
|
+
- **Usage:**
|
|
153
|
+
```javascript
|
|
154
|
+
const searchResults = await skillsService.searchSkills('javascript', {
|
|
155
|
+
limit: 10,
|
|
156
|
+
category: 'programming'
|
|
157
|
+
});
|
|
158
|
+
console.log(searchResults);
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### getSkillCategories()
|
|
162
|
+
|
|
163
|
+
- **Description:** Get all skill categories.
|
|
164
|
+
- **Returns:** A Promise that resolves to a list of skill categories.
|
|
165
|
+
- **Usage:**
|
|
166
|
+
```javascript
|
|
167
|
+
const categories = await skillsService.getSkillCategories();
|
|
168
|
+
console.log(categories);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### getSkillTypes()
|
|
172
|
+
|
|
173
|
+
- **Description:** Get all skill types.
|
|
174
|
+
- **Returns:** A Promise that resolves to a list of skill types.
|
|
175
|
+
- **Usage:**
|
|
176
|
+
```javascript
|
|
177
|
+
const types = await skillsService.getSkillTypes();
|
|
178
|
+
console.log(types);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### getRelatedSkills(skillId, options)
|
|
182
|
+
|
|
183
|
+
- **Description:** Get related skills for a specific skill.
|
|
184
|
+
- **Parameters:**
|
|
185
|
+
- `skillId` (string): The ID of the skill.
|
|
186
|
+
- `options` (object, optional): Additional options.
|
|
187
|
+
- `limit` (number, optional): Maximum number of related skills to return (default: 10).
|
|
188
|
+
- **Returns:** A Promise that resolves to related skills.
|
|
189
|
+
- **Usage:**
|
|
190
|
+
```javascript
|
|
191
|
+
const relatedSkills = await skillsService.getRelatedSkills('skill123', {
|
|
192
|
+
limit: 5
|
|
193
|
+
});
|
|
194
|
+
console.log(relatedSkills);
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### getSkillsByCategory(categoryId, options)
|
|
198
|
+
|
|
199
|
+
- **Description:** Get skills by category.
|
|
200
|
+
- **Parameters:**
|
|
201
|
+
- `categoryId` (string): The ID of the category.
|
|
202
|
+
- `options` (object, optional): Additional options.
|
|
203
|
+
- `limit` (number, optional): Maximum number of skills to return (default: 20).
|
|
204
|
+
- `offset` (number, optional): Number of skills to skip (default: 0).
|
|
205
|
+
- **Returns:** A Promise that resolves to skills in the category.
|
|
206
|
+
- **Usage:**
|
|
207
|
+
```javascript
|
|
208
|
+
const skillsInCategory = await skillsService.getSkillsByCategory('category123', {
|
|
209
|
+
limit: 15,
|
|
210
|
+
offset: 10
|
|
211
|
+
});
|
|
212
|
+
console.log(skillsInCategory);
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### getSkillsByType(typeId, options)
|
|
216
|
+
|
|
217
|
+
- **Description:** Get skills by type.
|
|
218
|
+
- **Parameters:**
|
|
219
|
+
- `typeId` (string): The ID of the type.
|
|
220
|
+
- `options` (object, optional): Additional options.
|
|
221
|
+
- `limit` (number, optional): Maximum number of skills to return (default: 20).
|
|
222
|
+
- `offset` (number, optional): Number of skills to skip (default: 0).
|
|
223
|
+
- **Returns:** A Promise that resolves to skills of the type.
|
|
224
|
+
- **Usage:**
|
|
225
|
+
```javascript
|
|
226
|
+
const skillsOfType = await skillsService.getSkillsByType('type123', {
|
|
227
|
+
limit: 15,
|
|
228
|
+
offset: 10
|
|
229
|
+
});
|
|
230
|
+
console.log(skillsOfType);
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### validateSkill(skillName)
|
|
234
|
+
|
|
235
|
+
- **Description:** Validate if a skill exists in the database.
|
|
236
|
+
- **Parameters:**
|
|
237
|
+
- `skillName` (string): The name of the skill to validate.
|
|
238
|
+
- **Returns:** A Promise that resolves to the validation result.
|
|
239
|
+
- **Usage:**
|
|
240
|
+
```javascript
|
|
241
|
+
const validationResult = await skillsService.validateSkill('JavaScript');
|
|
242
|
+
console.log(validationResult);
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Examples
|
|
246
|
+
|
|
247
|
+
### Search for Skills
|
|
248
|
+
|
|
249
|
+
```javascript
|
|
250
|
+
require('dotenv').config();
|
|
251
|
+
const { SharpApiSkillsDatabaseService } = require('@sharpapi/sharpapi-node-skills-database');
|
|
252
|
+
|
|
253
|
+
async function searchSkillsExample() {
|
|
254
|
+
const apiKey = process.env.SHARP_API_KEY;
|
|
255
|
+
const skillsService = new SharpApiSkillsDatabaseService(apiKey);
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
// Search for programming skills
|
|
259
|
+
const searchResults = await skillsService.searchSkills('programming', {
|
|
260
|
+
limit: 10,
|
|
261
|
+
category: 'technical'
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
console.log('Search Results:', searchResults);
|
|
265
|
+
|
|
266
|
+
// Get skill categories
|
|
267
|
+
const categories = await skillsService.getSkillCategories();
|
|
268
|
+
console.log('Skill Categories:', categories);
|
|
269
|
+
} catch (error) {
|
|
270
|
+
console.error('Error:', error.message);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
searchSkillsExample();
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Validate and Get Related Skills
|
|
278
|
+
|
|
279
|
+
```javascript
|
|
280
|
+
require('dotenv').config();
|
|
281
|
+
const { SharpApiSkillsDatabaseService } = require('@sharpapi/sharpapi-node-skills-database');
|
|
282
|
+
|
|
283
|
+
async function validateAndRelatedSkillsExample() {
|
|
284
|
+
const apiKey = process.env.SHARP_API_KEY;
|
|
285
|
+
const skillsService = new SharpApiSkillsDatabaseService(apiKey);
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
// Validate a skill
|
|
289
|
+
const skillName = 'JavaScript';
|
|
290
|
+
const validationResult = await skillsService.validateSkill(skillName);
|
|
291
|
+
console.log(`Validation Result for ${skillName}:`, validationResult);
|
|
292
|
+
|
|
293
|
+
if (validationResult.valid && validationResult.skill_id) {
|
|
294
|
+
// Get related skills
|
|
295
|
+
const relatedSkills = await skillsService.getRelatedSkills(validationResult.skill_id, {
|
|
296
|
+
limit: 5
|
|
297
|
+
});
|
|
298
|
+
console.log(`Related Skills for ${skillName}:`, relatedSkills);
|
|
299
|
+
}
|
|
300
|
+
} catch (error) {
|
|
301
|
+
console.error('Error:', error.message);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
validateAndRelatedSkillsExample();
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## API Documentation
|
|
311
|
+
|
|
312
|
+
For detailed usage and API methods, please refer to the [SharpAPI.com Documentation](https://sharpapi.com/documentation).
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Changelog
|
|
317
|
+
|
|
318
|
+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Contributing
|
|
323
|
+
|
|
324
|
+
Check [CONTRIBUTION.md](CONTRIBUTION.md) file for details.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## License
|
|
329
|
+
|
|
330
|
+
This project is licensed under the [MIT License](LICENSE.md).
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Support
|
|
335
|
+
|
|
336
|
+
If you encounter any issues or have questions, feel free to open an issue on the [GitHub repository](https://github.com/sharpapi/sharpapi-node-client/issues) or contact support at [contact@sharpapi.com](mailto:contact@sharpapi.com).
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Social Media
|
|
341
|
+
|
|
342
|
+
🚀 For the latest news, tutorials, and case studies, don't forget to follow us on:
|
|
343
|
+
- [SharpAPI X (formerly Twitter)](https://x.com/SharpAPI)
|
|
344
|
+
- [SharpAPI YouTube](https://www.youtube.com/@SharpAPI)
|
|
345
|
+
- [SharpAPI Vimeo](https://vimeo.com/SharpAPI)
|
|
346
|
+
- [SharpAPI LinkedIn](https://www.linkedin.com/products/a2z-web-ltd-sharpapicom-automate-with-aipowered-api/)
|
|
347
|
+
- [SharpAPI Facebook](https://www.facebook.com/profile.php?id=61554115896974)
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
**Happy Coding with SharpAPI Node.js Skills Database SDK!**
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sharpapi/sharpapi-node-skills-database",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SharpAPI.com Node.js SDK for Skills Database API",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "jest"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"sharpapi",
|
|
11
|
+
"api",
|
|
12
|
+
"api integration",
|
|
13
|
+
"restful api",
|
|
14
|
+
"nodejs",
|
|
15
|
+
"software development",
|
|
16
|
+
"skills",
|
|
17
|
+
"hr tech",
|
|
18
|
+
"job skills",
|
|
19
|
+
"skills database"
|
|
20
|
+
],
|
|
21
|
+
"author": "Dawid Makowski <contact@sharpapi.com>",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@sharpapi/sharpapi-node-core": "file:../sharpapi-node-core"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"jest": "^29.7.0"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/sharpapi/sharpapi-node-skills-database.git"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const { SharpApiCoreService } = require('@sharpapi/sharpapi-node-core');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Service for accessing Skills Database API using SharpAPI.com
|
|
5
|
+
*/
|
|
6
|
+
class SharpApiSkillsDatabaseService extends SharpApiCoreService {
|
|
7
|
+
/**
|
|
8
|
+
* Get list of all available skills
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<object>} - List of skills
|
|
11
|
+
*/
|
|
12
|
+
async getSkillsList() {
|
|
13
|
+
const response = await this.makeRequest('GET', '/utilities/skills_list');
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get detailed information about a specific skill by UUID
|
|
19
|
+
*
|
|
20
|
+
* @param {string} uuid - The UUID of the skill
|
|
21
|
+
* @returns {Promise<object>} - Skill information
|
|
22
|
+
*/
|
|
23
|
+
async getSkillDetails(uuid) {
|
|
24
|
+
const response = await this.makeRequest('GET', `/utilities/skills_details/${uuid}`);
|
|
25
|
+
return response.data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get information about a specific skill by ID (alias for getSkillDetails)
|
|
30
|
+
*
|
|
31
|
+
* @param {string} skillId - The ID of the skill
|
|
32
|
+
* @returns {Promise<object>} - Skill information
|
|
33
|
+
*/
|
|
34
|
+
async getSkillById(skillId) {
|
|
35
|
+
return this.getSkillDetails(skillId);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Search for skills by name or keyword
|
|
40
|
+
*
|
|
41
|
+
* @param {string} query - The search query
|
|
42
|
+
* @param {object} [options] - Additional options for search
|
|
43
|
+
* @param {number} [options.limit=20] - Maximum number of results to return
|
|
44
|
+
* @param {number} [options.offset=0] - Number of results to skip
|
|
45
|
+
* @param {string} [options.category] - Filter by skill category
|
|
46
|
+
* @param {string} [options.type] - Filter by skill type
|
|
47
|
+
* @returns {Promise<object>} - Search results
|
|
48
|
+
*/
|
|
49
|
+
async searchSkills(query, options = {}) {
|
|
50
|
+
const data = { query, ...options };
|
|
51
|
+
const response = await this.makeRequest('GET', '/utility/skills/search', data);
|
|
52
|
+
return response.data;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get all skill categories
|
|
57
|
+
*
|
|
58
|
+
* @returns {Promise<object>} - List of skill categories
|
|
59
|
+
*/
|
|
60
|
+
async getSkillCategories() {
|
|
61
|
+
const response = await this.makeRequest('GET', '/utility/skills/categories');
|
|
62
|
+
return response.data;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get all skill types
|
|
67
|
+
*
|
|
68
|
+
* @returns {Promise<object>} - List of skill types
|
|
69
|
+
*/
|
|
70
|
+
async getSkillTypes() {
|
|
71
|
+
const response = await this.makeRequest('GET', '/utility/skills/types');
|
|
72
|
+
return response.data;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get related skills for a specific skill
|
|
77
|
+
*
|
|
78
|
+
* @param {string} skillId - The ID of the skill
|
|
79
|
+
* @param {object} [options] - Additional options
|
|
80
|
+
* @param {number} [options.limit=10] - Maximum number of related skills to return
|
|
81
|
+
* @returns {Promise<object>} - Related skills
|
|
82
|
+
*/
|
|
83
|
+
async getRelatedSkills(skillId, options = {}) {
|
|
84
|
+
const data = { ...options };
|
|
85
|
+
const response = await this.makeRequest('GET', `/utility/skills/${skillId}/related`, data);
|
|
86
|
+
return response.data;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get skills by category
|
|
91
|
+
*
|
|
92
|
+
* @param {string} categoryId - The ID of the category
|
|
93
|
+
* @param {object} [options] - Additional options
|
|
94
|
+
* @param {number} [options.limit=20] - Maximum number of skills to return
|
|
95
|
+
* @param {number} [options.offset=0] - Number of skills to skip
|
|
96
|
+
* @returns {Promise<object>} - Skills in the category
|
|
97
|
+
*/
|
|
98
|
+
async getSkillsByCategory(categoryId, options = {}) {
|
|
99
|
+
const data = { ...options };
|
|
100
|
+
const response = await this.makeRequest('GET', `/utility/skills/category/${categoryId}`, data);
|
|
101
|
+
return response.data;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get skills by type
|
|
106
|
+
*
|
|
107
|
+
* @param {string} typeId - The ID of the type
|
|
108
|
+
* @param {object} [options] - Additional options
|
|
109
|
+
* @param {number} [options.limit=20] - Maximum number of skills to return
|
|
110
|
+
* @param {number} [options.offset=0] - Number of skills to skip
|
|
111
|
+
* @returns {Promise<object>} - Skills of the type
|
|
112
|
+
*/
|
|
113
|
+
async getSkillsByType(typeId, options = {}) {
|
|
114
|
+
const data = { ...options };
|
|
115
|
+
const response = await this.makeRequest('GET', `/utility/skills/type/${typeId}`, data);
|
|
116
|
+
return response.data;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Validate if a skill exists in the database
|
|
121
|
+
*
|
|
122
|
+
* @param {string} skillName - The name of the skill to validate
|
|
123
|
+
* @returns {Promise<object>} - Validation result
|
|
124
|
+
*/
|
|
125
|
+
async validateSkill(skillName) {
|
|
126
|
+
const data = { skill: skillName };
|
|
127
|
+
const response = await this.makeRequest('POST', '/utility/skills/validate', data);
|
|
128
|
+
return response.data;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
module.exports = { SharpApiSkillsDatabaseService };
|