@sargonpiraev/hh-api-client 1.0.0 → 1.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sargon Piraev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # HeadHunter API Client
2
2
 
3
+ ![npm version](https://img.shields.io/npm/v/@sargonpiraev/hh-api-client)
4
+ ![npm downloads](https://img.shields.io/npm/dw/@sargonpiraev/hh-api-client)
5
+ ![license](https://img.shields.io/github/license/sargonpiraev/hh-api-client)
6
+ ![pipeline status](https://gitlab.com/sargonpiraev/hh-api-client/badges/main/pipeline.svg)
7
+ ![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)
8
+
3
9
  A TypeScript client for the HeadHunter API, generated from the official OpenAPI specification.
4
10
 
5
11
  ## Features
@@ -14,13 +20,28 @@ A TypeScript client for the HeadHunter API, generated from the official OpenAPI
14
20
  ## Installation
15
21
 
16
22
  ```bash
17
- npm install hh-api-client
23
+ npm install @sargonpiraev/hh-api-client
18
24
  ```
19
25
 
26
+ ## Get Your Credentials
27
+
28
+ Before installation, you'll need HeadHunter API credentials:
29
+
30
+ 1. Visit [HeadHunter Developer Portal](https://dev.hh.ru/)
31
+ 2. Create an application to get client credentials
32
+ 3. For authenticated requests, implement OAuth flow to get access token
33
+ 4. Set up proper User-Agent format: `"AppName/Version (contact@example.com)"`
34
+
35
+ ## Requirements
36
+
37
+ - Node.js >= v18.0.0
38
+ - HeadHunter API credentials (User-Agent required, access token optional)
39
+ - npm >= 8.0.0
40
+
20
41
  ## Quick Start
21
42
 
22
43
  ```typescript
23
- import { createHeadHunterClient, getVacancies, getAreas, type GetVacanciesData } from 'hh-api-client'
44
+ import { createHeadHunterClient, getVacancies, getAreas, type GetVacanciesData } from '@sargonpiraev/hh-api-client'
24
45
 
25
46
  // Create a configured client
26
47
  const client = createHeadHunterClient({
@@ -54,7 +75,7 @@ console.log('Available areas:', areas.data)
54
75
  ### Search Vacancies
55
76
 
56
77
  ```typescript
57
- import { getVacancies, type GetVacanciesData } from 'hh-api-client'
78
+ import { getVacancies, type GetVacanciesData } from '@sargonpiraev/hh-api-client'
58
79
 
59
80
  const searchParams: GetVacanciesData = {
60
81
  query: {
@@ -76,7 +97,7 @@ const result = await getVacancies({ client, ...searchParams })
76
97
  ### Get Vacancy Details
77
98
 
78
99
  ```typescript
79
- import { getVacancy } from 'hh-api-client'
100
+ import { getVacancy } from '@sargonpiraev/hh-api-client'
80
101
 
81
102
  const vacancy = await getVacancy({
82
103
  client,
@@ -90,7 +111,7 @@ console.log(vacancy.data.description)
90
111
  ### Apply to Vacancy
91
112
 
92
113
  ```typescript
93
- import { applyToVacancy } from 'hh-api-client'
114
+ import { applyToVacancy } from '@sargonpiraev/hh-api-client'
94
115
 
95
116
  await applyToVacancy({
96
117
  client,
@@ -105,7 +126,7 @@ await applyToVacancy({
105
126
  ### Work with Dictionaries
106
127
 
107
128
  ```typescript
108
- import { getAreas, getIndustries, getSkills, getProfessionalRolesDictionary } from 'hh-api-client'
129
+ import { getAreas, getIndustries, getSkills, getProfessionalRolesDictionary } from '@sargonpiraev/hh-api-client'
109
130
 
110
131
  // Get all areas (cities/regions)
111
132
  const areas = await getAreas({ client })
@@ -123,7 +144,7 @@ const roles = await getProfessionalRolesDictionary({ client })
123
144
  ### User Information
124
145
 
125
146
  ```typescript
126
- import { getCurrentUserInfo, editCurrentUserInfo } from 'hh-api-client'
147
+ import { getCurrentUserInfo, editCurrentUserInfo } from '@sargonpiraev/hh-api-client'
127
148
 
128
149
  // Get current user info
129
150
  const user = await getCurrentUserInfo({ client })
@@ -196,7 +217,7 @@ The client exports all generated SDK functions. See the [HeadHunter API document
196
217
 
197
218
  ```typescript
198
219
  // Import everything
199
- import * as HHApi from 'hh-api-client'
220
+ import * as HHApi from '@sargonpiraev/hh-api-client'
200
221
 
201
222
  // Or import specific functions
202
223
  import {
@@ -204,7 +225,7 @@ import {
204
225
  getNegotiations,
205
226
  createResume,
206
227
  // ... etc
207
- } from 'hh-api-client'
228
+ } from '@sargonpiraev/hh-api-client'
208
229
  ```
209
230
 
210
231
  ## TypeScript Support
@@ -212,7 +233,7 @@ import {
212
233
  Full TypeScript support with generated types:
213
234
 
214
235
  ```typescript
215
- import type { GetVacanciesData, GetVacanciesResponses, Vacancy, Area, Industry } from 'hh-api-client'
236
+ import type { GetVacanciesData, GetVacanciesResponses, Vacancy, Area, Industry } from '@sargonpiraev/hh-api-client'
216
237
 
217
238
  const handleVacancy = (vacancy: Vacancy) => {
218
239
  console.log(vacancy.name)
@@ -237,25 +258,38 @@ try {
237
258
  }
238
259
  ```
239
260
 
240
- ## Development
261
+ ## Roadmap
241
262
 
242
- ```bash
243
- # Install dependencies
244
- npm install
263
+ **Coming Soon** 🚀
245
264
 
246
- # Generate types from OpenAPI spec
247
- npm run openapi-ts
265
+ - [ ] **Enhanced Type Safety**: Additional validation and type guards
266
+ - [ ] **Response Caching**: Intelligent caching for frequently accessed data
267
+ - [ ] **Batch Operations**: Support for bulk API operations
268
+ - [ ] **Rate Limiting**: Built-in rate limiting and retry logic
269
+ - [ ] **Offline Support**: Offline-first capabilities with sync
270
+ - [ ] **React Hooks**: React hooks package for easier integration
248
271
 
249
- # Build
250
- npm run build
272
+ **Completed** ✅
251
273
 
252
- # Test
253
- npm run test
274
+ - [x] **Full API Coverage**: Complete HeadHunter API integration
275
+ - [x] **Type Generation**: Automated TypeScript types from OpenAPI
276
+ - [x] **Error Handling**: Comprehensive error management
277
+ - [x] **Tree Shaking**: Optimized bundle size with selective imports
254
278
 
255
- # Lint
256
- npm run lint
257
- ```
279
+ **Community Requests** 💭
280
+
281
+ Have an idea for HeadHunter API Client? [Open an issue](https://github.com/sargonpiraev/hh-api-client/issues) or contribute to our roadmap!
282
+
283
+ ## Support This Project
284
+
285
+ Hi! I'm Sargon Piraev, a software engineer passionate about API integrations and developer tools. I create open-source API clients to help developers integrate with their favorite services more easily.
286
+
287
+ Your support helps me continue developing and maintaining these tools, and motivates me to create new integrations that make developer workflows even more efficient! 🚀
288
+
289
+ [![Support on Boosty](https://img.shields.io/badge/Support-Boosty-orange?logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJMMTMuMDkgOC4yNkwyMCA5TDEzLjA5IDE1Ljc0TDEyIDIyTDEwLjkxIDE1Ljc0TDQgOUwxMC45MSA4LjI2TDEyIDJaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://boosty.to/sargonpiraev)
258
290
 
259
- ## License
291
+ ## Connect with Author
260
292
 
261
- MIT
293
+ - 🌐 Visit [sargonpiraev.com](https://sargonpiraev.com)
294
+ - 📧 Email: [sargonpiraev@gmail.com](mailto:sargonpiraev@gmail.com)
295
+ - 💼 LinkedIn: [linkedin.com/in/sargonpiraev](https://linkedin.com/in/sargonpiraev)
@@ -0,0 +1,9 @@
1
+ import * as sdk from './generated/sdk.gen.js';
2
+ export interface Config {
3
+ userAgent: string;
4
+ }
5
+ export declare class HhApiClient {
6
+ private client;
7
+ constructor(config: Config);
8
+ sdk: typeof sdk;
9
+ }
@@ -0,0 +1,12 @@
1
+ import { client } from './generated/client.gen.js';
2
+ import * as sdk from './generated/sdk.gen.js';
3
+ export class HhApiClient {
4
+ client;
5
+ constructor(config) {
6
+ this.client = client;
7
+ this.client.setConfig({
8
+ headers: { 'User-Agent': config.userAgent },
9
+ });
10
+ }
11
+ sdk = sdk;
12
+ }
@@ -1,22 +1,3 @@
1
- export { client } from './generated/client.gen.js';
2
- export { createClient } from './generated/client/index.js';
3
- export type { Client, Options } from './generated/client/index.js';
4
- export { getVacancies, getVacancy, getFavoriteVacancies, addVacancyToFavorite, deleteVacancyFromFavorite, getVacanciesSimilarToResume, applyToVacancy, } from './generated/index.js';
5
- export { getDictionaries, getAreas, getIndustries, getLanguages, getSkills, getProfessionalRolesDictionary, getMetroStations, getMetroStationsInCity, } from './generated/index.js';
6
- export { getCurrentUserInfo, editCurrentUserInfo, authorize, invalidateToken } from './generated/index.js';
7
- export { getMineResumes, getResume, createResume, editResume, deleteResume, publishResume, searchForResumes, getResumeConditions, } from './generated/index.js';
8
- export { getNegotiations, getNegotiationItem, getNegotiationMessages, sendNegotiationMessage, changeNegotiationAction, } from './generated/index.js';
9
- export type { GetVacanciesData, GetVacanciesResponses, GetVacancyData, GetVacancyResponses, ApplyToVacancyData, ApplyToVacancyResponses, GetDictionariesResponses, GetAreasResponses, GetIndustriesResponses, GetLanguagesResponses, GetSkillsResponses, GetCurrentUserInfoResponses, AuthorizeData, AuthorizeResponses, GetMineResumesResponses, GetResumeData, GetResumeResponses, CreateResumeData, CreateResumeResponses, EditResumeData, EditResumeResponses, SearchForResumesData, SearchForResumesResponses, GetNegotiationsData, GetNegotiationsResponses, GetNegotiationItemData, GetNegotiationItemResponses, SendNegotiationMessageData, SendNegotiationMessageResponses, ChangeNegotiationActionData, ChangeNegotiationActionResponses, } from './generated/index.js';
10
- export * from './generated/index.js';
11
- /**
12
- * Create a pre-configured HeadHunter API client
13
- * @param config Configuration options
14
- * @returns Configured client instance
15
- */
16
- export declare function createHeadHunterClient(config: {
17
- userAgent: string;
18
- accessToken?: string;
19
- baseURL?: string;
20
- }): import("./generated/client/types.js").Client;
21
- export declare const HH_API_BASE_URL = "https://api.hh.ru";
22
- export declare const HH_REQUIRED_USER_AGENT_FORMAT = "AppName/Version (contact@example.com)";
1
+ export { HhApiClient } from './HhApiClient.js';
2
+ export { HhApiClient as default } from './HhApiClient.js';
3
+ export * from './types.js';
@@ -1,37 +1,3 @@
1
- // HeadHunter API Client
2
- // Re-exports from generated SDK with organized structure
3
- // === Core Client & Configuration ===
4
- export { client } from './generated/client.gen.js';
5
- export { createClient } from './generated/client/index.js';
6
- // === Most Used Functions ===
7
- // Vacancy search and management
8
- export { getVacancies, getVacancy, getFavoriteVacancies, addVacancyToFavorite, deleteVacancyFromFavorite, getVacanciesSimilarToResume, applyToVacancy, } from './generated/index.js';
9
- // Dictionaries and references
10
- export { getDictionaries, getAreas, getIndustries, getLanguages, getSkills, getProfessionalRolesDictionary, getMetroStations, getMetroStationsInCity, } from './generated/index.js';
11
- // User and authentication
12
- export { getCurrentUserInfo, editCurrentUserInfo, authorize, invalidateToken } from './generated/index.js';
13
- // Resume management
14
- export { getMineResumes, getResume, createResume, editResume, deleteResume, publishResume, searchForResumes, getResumeConditions, } from './generated/index.js';
15
- // Negotiations
16
- export { getNegotiations, getNegotiationItem, getNegotiationMessages, sendNegotiationMessage, changeNegotiationAction, } from './generated/index.js';
17
- // === All Functions (for advanced usage) ===
18
- export * from './generated/index.js';
19
- // === Helper Configuration ===
20
- import { createClient } from './generated/client/index.js';
21
- /**
22
- * Create a pre-configured HeadHunter API client
23
- * @param config Configuration options
24
- * @returns Configured client instance
25
- */
26
- export function createHeadHunterClient(config) {
27
- return createClient({
28
- baseUrl: config.baseURL || 'https://api.hh.ru',
29
- headers: {
30
- 'User-Agent': config.userAgent,
31
- ...(config.accessToken && { Authorization: `Bearer ${config.accessToken}` }),
32
- },
33
- });
34
- }
35
- // === Constants ===
36
- export const HH_API_BASE_URL = 'https://api.hh.ru';
37
- export const HH_REQUIRED_USER_AGENT_FORMAT = 'AppName/Version (contact@example.com)';
1
+ export { HhApiClient } from './HhApiClient.js';
2
+ export { HhApiClient as default } from './HhApiClient.js';
3
+ export * from './types.js';
@@ -0,0 +1 @@
1
+ export * from './generated/types.gen.js';
@@ -0,0 +1 @@
1
+ export * from './generated/types.gen.js';
package/package.json CHANGED
@@ -1,13 +1,37 @@
1
1
  {
2
2
  "name": "@sargonpiraev/hh-api-client",
3
- "version": "1.0.0",
4
- "description": "",
5
- "main": "./build/index.js",
6
- "types": "./build/generated/types.gen.ts",
3
+ "version": "1.1.0",
4
+ "description": "A TypeScript client for the HeadHunter API, generated from the official OpenAPI specification.",
5
+ "main": "./build/src/index.js",
6
+ "types": "./build/src/index.d.ts",
7
7
  "type": "module",
8
8
  "files": [
9
- "build"
9
+ "build",
10
+ "README.md",
11
+ "LICENSE"
10
12
  ],
13
+ "keywords": [
14
+ "api-client",
15
+ "typescript",
16
+ "sdk",
17
+ "headhunter",
18
+ "hh",
19
+ "openapi",
20
+ "job-search",
21
+ "recruiting"
22
+ ],
23
+ "author": {
24
+ "name": "Sargon Piraev",
25
+ "email": "sargonpiraev@gmail.com"
26
+ },
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://gitlab.com/sargonpiraev/hh-api-client.git"
31
+ },
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
11
35
  "scripts": {
12
36
  "test": "jest --passWithNoTests --coverage",
13
37
  "dev": "tsx watch ./src/index.ts",