node-behind-api-client 2.0.48 → 2.0.49
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 +153 -48
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,65 +1,170 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Node Behind API Client
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
A comprehensive Node.js client library for interacting with the Behind.ai API ecosystem. This package provides seamless integration with multiple Behind.ai services including EasyJob recruitment management, GPT services, payments, storage, and more.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install node-behind-api-client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Basic Setup
|
|
5
14
|
|
|
6
15
|
```javascript
|
|
7
|
-
|
|
16
|
+
const BehindApiClient = require('node-behind-api-client');
|
|
17
|
+
|
|
18
|
+
// Initialize the client
|
|
19
|
+
const behindAPI = new BehindApiClient('https://api.app.behind.ai', 'your-access-token');
|
|
20
|
+
|
|
21
|
+
// For self-signed certificates (development)
|
|
22
|
+
behindAPI.selfsigned = true;
|
|
8
23
|
```
|
|
9
24
|
|
|
10
|
-
|
|
25
|
+
### Simple Usage Example
|
|
11
26
|
|
|
12
27
|
```javascript
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
0, // Page number
|
|
26
|
-
25 // Page size
|
|
27
|
-
);
|
|
28
|
+
// Example: Create a company in EasyJob
|
|
29
|
+
async function createCompany() {
|
|
30
|
+
try {
|
|
31
|
+
const result = await behindAPI.easyjob.V10.companies.create("My Company");
|
|
32
|
+
console.log('Company created:', result);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('Error:', error);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
createCompany();
|
|
28
39
|
```
|
|
29
40
|
|
|
41
|
+
## Available Services
|
|
42
|
+
|
|
43
|
+
The client provides access to the following Behind.ai services:
|
|
44
|
+
|
|
45
|
+
- **easyjob** - Recruitment and candidate management
|
|
46
|
+
- **gpt** - AI and language model services
|
|
47
|
+
- **payments** - Payment processing (Payture, Stripe)
|
|
48
|
+
- **storage** - File storage and management
|
|
49
|
+
- **mailer** - Email services
|
|
50
|
+
- **chat** - Chat and messaging
|
|
51
|
+
- **sales** - Sales management
|
|
52
|
+
- **monitor** - System monitoring
|
|
53
|
+
- **tools** - Utility tools (PDF processing, etc.)
|
|
54
|
+
- **oauth** - OAuth authentication
|
|
55
|
+
- **rag** - Retrieval-Augmented Generation
|
|
56
|
+
- **global** - Global services
|
|
57
|
+
- **mastogram** - Social media integration
|
|
58
|
+
- **tests** - Testing utilities
|
|
59
|
+
|
|
60
|
+
## Event Handlers
|
|
61
|
+
|
|
62
|
+
The client provides event handlers for common scenarios:
|
|
30
63
|
|
|
31
|
-
## GptPromptGet
|
|
32
64
|
```javascript
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
// Handle expired tokens
|
|
66
|
+
behindAPI.onExpired(() => {
|
|
67
|
+
console.log('Token expired, please refresh');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Handle rejected requests
|
|
71
|
+
behindAPI.onReject((response) => {
|
|
72
|
+
console.log('Request rejected:', response);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Handle rate limiting
|
|
76
|
+
behindAPI.onTooManyRequests((response) => {
|
|
77
|
+
console.log('Rate limit exceeded:', response);
|
|
78
|
+
});
|
|
42
79
|
```
|
|
43
80
|
|
|
44
|
-
##
|
|
81
|
+
## Direct API Requests
|
|
82
|
+
|
|
83
|
+
You can also make direct API requests using the generic request method:
|
|
84
|
+
|
|
45
85
|
```javascript
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let res = await zecamp.MailerMessageSend(
|
|
52
|
-
'test@behind.ai',
|
|
53
|
-
'James',
|
|
54
|
-
'_smtp_sales_behind_ai_default',
|
|
55
|
-
'_template_behind_ai_default',
|
|
56
|
-
message);
|
|
86
|
+
// Direct request format: /app/version/module/method
|
|
87
|
+
const result = await behindAPI.request('/easyjob/V10/companies/create', {
|
|
88
|
+
name: 'Company Name'
|
|
89
|
+
});
|
|
57
90
|
```
|
|
58
91
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
92
|
+
## Authentication
|
|
93
|
+
|
|
94
|
+
The client supports multiple authentication methods:
|
|
95
|
+
|
|
96
|
+
1. **Bearer Token** (recommended)
|
|
97
|
+
2. **Access Token** in request headers
|
|
98
|
+
3. **Access Token** in request body
|
|
99
|
+
|
|
100
|
+
Authentication is handled automatically when you provide the access token during initialization.
|
|
101
|
+
|
|
102
|
+
## Documentation
|
|
103
|
+
|
|
104
|
+
For detailed API documentation and examples for each service, refer to the documentation in the `docs/behind-api-client/` directory:
|
|
105
|
+
|
|
106
|
+
### EasyJob Documentation
|
|
107
|
+
- [EasyJob Overview](docs/behind-api-client/easyjob/README.md) - Complete recruitment management API
|
|
108
|
+
- [Job Descriptions](docs/behind-api-client/easyjob/JobDescriptions/README.md) - Job posting management
|
|
109
|
+
- [Candidate Profiles](docs/behind-api-client/easyjob/candidateProfiles/README.md) - Candidate management
|
|
110
|
+
- [Applications](docs/behind-api-client/easyjob/applications/README.md) - Application processing
|
|
111
|
+
- [Applicants](docs/behind-api-client/easyjob/applicants/README.md) - Applicant management
|
|
112
|
+
- [Candidate Questions](docs/behind-api-client/easyjob/jd-candidate-questions/README.md) - Interview questions
|
|
113
|
+
|
|
114
|
+
### Payment Documentation
|
|
115
|
+
- [Payture Integration](docs/behind-api-client/payments/payture/README.md) - Standard payment processing
|
|
116
|
+
- [Payture Cards](docs/behind-api-client/payments/payture/README.cards.md) - Card payment processing
|
|
117
|
+
- [Payture Subscriptions](docs/behind-api-client/payments/payture/README.subscriptions.md) - Subscription management
|
|
118
|
+
- [Payture v2.1](docs/behind-api-client/payments/payture/README.21.md) - Enhanced payment features
|
|
119
|
+
- [RuKitchen Integration](docs/behind-api-client/payments/payture/README.rukitchen.md) - Restaurant-specific payments
|
|
120
|
+
- [Stripe Flow](docs/behind-api-client/payments/stripe/README.flow.md) - Stripe payment integration
|
|
121
|
+
|
|
122
|
+
### Storage Documentation
|
|
123
|
+
- [RAG Storage](docs/behind-api-client/rag/storage/README.md) - Retrieval-Augmented Generation storage
|
|
124
|
+
|
|
125
|
+
## Error Handling
|
|
126
|
+
|
|
127
|
+
All API methods return promises and should be wrapped in try-catch blocks:
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
try {
|
|
131
|
+
const result = await behindAPI.easyjob.V10.companies.create("Company Name");
|
|
132
|
+
if (result.success) {
|
|
133
|
+
console.log('Success:', result.data);
|
|
134
|
+
} else {
|
|
135
|
+
console.log('Failed:', result.message);
|
|
136
|
+
}
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error('Exception:', error);
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Response Format
|
|
143
|
+
|
|
144
|
+
All API responses follow a consistent format:
|
|
145
|
+
|
|
146
|
+
**Success Response:**
|
|
147
|
+
```javascript
|
|
148
|
+
{
|
|
149
|
+
success: true,
|
|
150
|
+
data: { /* response data */ }
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Error Response:**
|
|
155
|
+
```javascript
|
|
156
|
+
{
|
|
157
|
+
success: false,
|
|
158
|
+
message: "Error description",
|
|
159
|
+
code: 1001 // Error code
|
|
160
|
+
}
|
|
65
161
|
```
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
ISC
|
|
166
|
+
|
|
167
|
+
## Repository
|
|
168
|
+
|
|
169
|
+
This package is maintained in the Behind.ai private repository. For issues and contributions, contact the development team.
|
|
170
|
+
|